def show_text(filePath, title=""): if title == "": title = "show_text" buf = """<!doctype html> <html> <head> <meta charset="utf-8" /> <title>""" buf += title buf += """</title> </head> <body> <h1 style='text-align:center;'>""" buf += title buf += """</h1> <br /> <pre style='margin-left:5%;'> """ buf += escape(fs.readAllText(filePath)) buf += """</pre> <p> </p> <p> </p> <p> </p> </body> </html> """ return buf
def showSource(filePath, style="default"): text = fs.readAllText(filePath) source = WebPage.WebPage.escape(text) title = fs.getFileName(filePath) return render_template("showSource.html", source=source, title=title, style=style)
def index(): home_folder = '"' + fs.getHomeDirectory() + '"' orderby = request.args.get("orderby") hiddenfile = request.args.get("hiddenfile") textview = request.args.get("textview") favarray = fs.readAllText("fav_folders.csv") return render_template('index.html', version='1.0', home=home_folder, fav_folder=favarray)
def text_content(): path = request.args.get("path") s = fs.readAllText(path) return s