changeset 1006:58ef814cc83e

formatting: Replace `python-hoedown` with `misaka`.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 25 Nov 2017 22:37:46 -0800
parents 2e5c5d33d62c
children 09dc0240f08a
files piecrust/formatting/hoedownformatter.py requirements.txt
diffstat 2 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/formatting/hoedownformatter.py	Tue Nov 21 22:07:12 2017 -0800
+++ b/piecrust/formatting/hoedownformatter.py	Sat Nov 25 22:37:46 2017 -0800
@@ -16,13 +16,13 @@
     def render(self, format_name, txt):
         assert format_name in self.FORMAT_NAMES
         self._ensureInitialized()
-        return self._formatter.render(txt)
+        return self._formatter(txt)
 
     def _ensureInitialized(self):
         if self._formatter is not None:
             return
 
-        import hoedown
+        import misaka
 
         # Don't show warnings once for each worker when baking, so only
         # show them for the first. If the variable is not set, we're not
@@ -55,18 +55,18 @@
         other = 0
         for n in extensions:
             # Try an extension?
-            e = getattr(hoedown, 'EXT_' + n.upper(), None)
+            e = getattr(misaka, 'EXT_' + n.upper(), None)
             if e is not None:
                 exts |= e
                 continue
 
             # Try a render flag?
-            f = getattr(hoedown, 'HTML_' + n.upper(), None)
+            f = getattr(misaka, 'HTML_' + n.upper(), None)
             if f is not None:
                 rdrf |= f
 
             # Other flag?
-            f = getattr(hoedown, 'TABLE_' + n.upper(), None)
+            f = getattr(misaka, 'TABLE_' + n.upper(), None)
             if f is not None:
                 other |= f
 
@@ -81,9 +81,9 @@
                 t = [t]
             for i in t:
                 if i.startswith('EXT_'):
-                    exts |= getattr(hoedown, i)
+                    exts |= getattr(misaka, i)
                 elif i.startswith('HTML_'):
-                    rdrf |= getattr(hoedown, i)
+                    rdrf |= getattr(misaka, i)
                 elif show_warnings:
                     logger.warning("Unknown Hoedown Markdown extension or flag:"
                                    "%s" % n)
@@ -97,11 +97,10 @@
                     "specific extensions.")
 
         # Enable a few things by default.
-        exts |= hoedown.EXT_NO_INTRA_EMPHASIS
+        exts |= misaka.EXT_NO_INTRA_EMPHASIS
 
-        renderer = hoedown.HtmlRenderer(flags=rdrf)
-        self._formatter = hoedown.Markdown(
-                renderer, extensions=(exts | other))
+        renderer = misaka.HtmlRenderer(flags=rdrf)
+        self._formatter = misaka.Markdown(renderer, extensions=(exts | other))
 
 
 ext_translate = {
--- a/requirements.txt	Tue Nov 21 22:07:12 2017 -0800
+++ b/requirements.txt	Sat Nov 25 22:37:46 2017 -0800
@@ -1,23 +1,23 @@
 appdirs==1.4.3
 asn1crypto==0.22.0
-cffi==1.5.0
+cffi==1.11.2
 colorama==0.3.3
 compressinja==0.0.2
 cryptography==1.8.1
 Flask==0.10.1
 Flask-IndieAuth==0.0.3.2
 Flask-Login==0.3.2
-hoedown==0.2.3
 idna==2.5
 itsdangerous==0.24
 Jinja2==2.9.6
 Markdown==2.6.2
 MarkupSafe==1.0
+misaka==2.1.0
 packaging==16.8
 paramiko==2.0.0
 py==1.4.33
 pyasn1==0.2.3
-pycparser==2.17
+pycparser==2.18
 Pygments==2.0.2
 pyparsing==2.2.0
 pystache==0.5.4