예제 #1
0
파일: models.py 프로젝트: jkossen/imposter
    def compile(self, repl=None):
        input_summary = self.summary
        input_content = self.content
        if repl is not None:
            input_summary = multi_replace(input_summary, repl)
            input_content = multi_replace(input_content, repl)

        self.summary_html = markup_to_html(self.format, input_summary)
        self.content_html = markup_to_html(self.format, input_content)
예제 #2
0
파일: 003.py 프로젝트: jkossen/imposter
def upgrade(app):
    """ data migration to update the Tag.count fields """
    db_session = DB(app.config['DATABASE']).get_session()
    existing_posts = db_session.query(Post).all()

    for post in existing_posts:
        post.summary_html = markup_to_html(post.format, post.summary)
        post.content_html = markup_to_html(post.format, post.content)

    db_session.commit()
예제 #3
0
def tf_to_html(content, format):
    """Convert input to html"""
    return markup_to_html(format, content)