def page_article(path): p = pattern_article_path.findall(path) if not p: abort(404) gitname, subdir, name = p[0] with app.open_resource("static/article.html") as f: art = article.get_article(gitname, subdir, "%s.md" % name) if not art: abort(404) title = art["title"] cont = art["content"]["html"] toc = art["content"]["toc"] contents = f.read().decode("utf-8") contents = render_mark(contents, article_title=title, article_content=cont, article_toc=toc) return contents
def page_article(path): p = pattern_article_path.findall(path) if not p: abort(404) git_username, subdir, name = p[0] with app.open_resource("static/article.html") as f: art = article.get_article(git_username, subdir, "%s.md" % name) if not art: abort(404) title, cont, toc = art["meta"]["title"], art["content"], art["toc"] contents = f.read() contents = contents.decode("utf-8") contents = contents.replace('{{"article_title"}}', title) contents = contents.replace('{{"article_content"}}', cont) contents = contents.replace('{{"article_toc"}}', toc) return contents