コード例 #1
0
ファイル: utils.py プロジェクト: jensl/critic
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
コード例 #2
0
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")
コード例 #3
0
ファイル: utils.py プロジェクト: tomekjarosik/critic
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
コード例 #4
0
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")
コード例 #5
0
ファイル: utils.py プロジェクト: Aessy/critic
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)
コード例 #6
0
ファイル: utils.py プロジェクト: yanlimin9/critic
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)
コード例 #7
0
ファイル: tutorial.py プロジェクト: Tigge/critic
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")
コード例 #8
0
ファイル: news.py プロジェクト: Aessy/critic
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")