]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Support Markdown
authorOleg Broytman <phd@phdru.name>
Fri, 7 Jun 2013 21:43:44 +0000 (21:43 +0000)
committerOleg Broytman <phd@phdru.name>
Fri, 7 Jun 2013 21:43:44 +0000 (21:43 +0000)
git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@148 7bb0bf08-9e0d-0410-b083-99cee3bf18b8

phd.py

diff --git a/phd.py b/phd.py
index 1e34234998a569fbe621cc7256bdd76c521044ed..f34437a9af1b647e5f3078f6978a0c14bd91ac67 100644 (file)
--- 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 """\