From c978d4eac730a7fa0d578c4946fcc88854ba8aef Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 7 Jun 2013 21:43:44 +0000 Subject: [PATCH] Support Markdown git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@148 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- phd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phd.py b/phd.py index 1e34234..f34437a 100644 --- a/phd.py +++ b/phd.py @@ -44,6 +44,8 @@ class phd(Template): return self.text2html() if hasattr(self, "body_rst"): return self.rst2html() + if hasattr(self, "body_mkd"): + return self.mkd2html() def text2html(self): body = re.sub(url_re, _url2href, self.body_text()) @@ -81,6 +83,9 @@ class phd(Template): parts = [part for part in (title, subtitle, body) if part] return "\n\n".join(parts) + def mkd2html(self): + from markdown import markdown + return markdown(self.body_mkd(), output_format="html") def img_thumbnail_800_1024(self, img_name): return """\ -- 2.39.5