[website] parse markdown

This commit is contained in:
Rushabh Mehta 2015-03-11 12:00:36 +05:30
parent 59306e76d5
commit fa938045ed
2 changed files with 4 additions and 5 deletions

View file

@ -9,6 +9,7 @@ from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.utils import today, cint, global_date_format, get_fullname
from frappe.website.utils import find_first_image, get_comment_list
from markdown2 import markdown
class BlogPost(WebsiteGenerator):
save_versions = True
@ -64,6 +65,9 @@ class BlogPost(WebsiteGenerator):
"description": context.description,
}
if "<!-- markdown -->" in context.content:
context.content = markdown(context.content)
image = find_first_image(self.content)
if image:
context.metatags["image"] = image

View file

@ -49,11 +49,6 @@ def render_blocks(context):
if "title" not in out:
out["title"] = context.get("title")
# markdown
if "<!-- markdown -->" in out.get("content", ""):
out["content"] = markdown(out["content"])
# header
if out["no_header"]:
out["header"] = ""