Пример #1
0
Файл: app.py Проект: janLo/sipa
def index():
    """Get all markdown files from 'news/', parse them and put
    them in a list for the template.

    The format is like this (Pelican compatible):

        Title: ABC
        Author: userX
        Date: 1970-01-01
        [Type: alert]

        Message

    The type field does not need to be used. If you use it, check what types
    are available. For now, it's only 'alert' which colors the news entry red.
    """
    cf_pages.reload()
    latest = cf_pages.get_articles_of_category('news')
    latest = sorted(latest, key=lambda a: a.date, reverse=True)
    latest = latest[0:10]
    return render_template("index.html", articles=latest)
Пример #2
0
def index():
    """Get all markdown files from 'news/', parse them and put
    them in a list for the template.

    The format is like this (Pelican compatible):

        Title: ABC
        Author: userX
        Date: 1970-01-01
        [Type: alert]

        Message

    The type field does not need to be used. If you use it, check what types
    are available. For now, it's only 'alert' which colors the news entry red.
    """
    cf_pages.reload()
    latest = cf_pages.get_articles_of_category('news')
    latest = sorted(latest, key=lambda a: a.date, reverse=True)
    latest = latest[0:10]
    return render_template("index.html", articles=latest)
Пример #3
0
def show(category_id, article_id):
    # todo think of a more elegant way to reload
    cf_pages.reload()
    article = cf_pages.get_or_404(category_id, article_id)
    return render_template('template.html', article=article)
Пример #4
0
def show(category_id, article_id):
    # todo think of a more elegant way to reload
    cf_pages.reload()
    article = cf_pages.get_or_404(category_id, article_id)
    return render_template('template.html', article=article)