def displayFormattedText(db, req, user, source): document = htmlutils.Document(req) document.setBase(None) document.addExternalStylesheet("resource/tutorial.css") document.addInternalStylesheet("div.main table td.text { %s }" % user.getPreference(db, "style.tutorialFont")) html = document.html() head = html.head() body = html.body() generateHeader(body, db, user) if isinstance(source, basestring): lines = source.splitlines() else: lines = source import textformatting textformatting.renderFormatted( db, user, body.div("main").table("paleyellow"), source, toc=True) generateFooter(body, db, user) return document
def renderFromFile(db, user, target, name): lines = open("%s/tutorials/%s.txt" % (configuration.paths.INSTALL_DIR, name)).read().splitlines() table = target.table("paleyellow", align="center") textformatting.renderFormatted(db, user, table, lines, toc=True) table.tr("back").td("back").div().a(href="tutorial").text("Back")
def displayFormattedText(db, req, user, source): document = htmlutils.Document(req) document.setBase(None) document.addExternalStylesheet("resource/tutorial.css") document.addInternalStylesheet( "div.main table td.text { %s }" % user.getPreference(db, "style.tutorialFont")) html = document.html() head = html.head() body = html.body() generateHeader(body, db, user) if isinstance(source, basestring): lines = source.splitlines() else: lines = source import textformatting textformatting.renderFormatted(db, user, body.div("main").table("paleyellow"), source, toc=True) generateFooter(body, db, user) return document
def renderNewsItem(db, user, target, text, timestamp): table = target.table("paleyellow", align="center") textformatting.renderFormatted(db, user, table, text.splitlines(), toc=False, title_right=timestamp) table.tr("back").td("back").div().a("back", href="news").text("Back")
def renderTutorial(db, user, source): document = htmlutils.Document() document.addExternalStylesheet("resource/tutorial.css") document.addExternalScript("resource/tutorial.js") document.addInternalStylesheet("div.main table td.text { %s }" % user.getPreference(db, "style.tutorialFont")) html = document.html() head = html.head() body = html.body() page.utils.generateHeader(body, db, user) table = body.div("main").table("paleyellow", align="center") textformatting.renderFormatted(db, user, table, source.splitlines(), toc=True) return str(document)
def renderTutorial(db, user, source): document = htmlutils.Document() document.addExternalStylesheet("resource/tutorial.css") document.addExternalScript("resource/tutorial.js") document.addInternalStylesheet( "div.main table td.text { %s }" % user.getPreference(db, "style.tutorialFont")) html = document.html() head = html.head() body = html.body() page.utils.generateHeader(body, db, user) table = body.div("main").table("paleyellow", align="center") textformatting.renderFormatted(db, user, table, source.splitlines(), toc=True) return str(document)
def renderFromFile(db, target, name): lines = open("%s/tutorials/%s.txt" % (configuration.paths.INSTALL_DIR, name)).read().splitlines() table = target.table("paleyellow", align="center") textformatting.renderFormatted(db, table, lines, toc=True) table.tr("back").td("back").div().a(href="tutorial").text("Back")