Browse Source

Merge pull request #817 from xsteadfastx/master

liquid_tags: pelican 3.7 compatible
Justin Mayer 7 years ago
parent
commit
94c19c1b71
2 changed files with 10 additions and 5 deletions
  1. 8 4
      liquid_tags/liquid_tags.py
  2. 2 1
      liquid_tags/notebook.py

+ 8 - 4
liquid_tags/liquid_tags.py

@@ -3,18 +3,22 @@ from .mdx_liquid_tags import LiquidTags, LT_CONFIG
 
 
 def addLiquidTags(gen):
-    if not gen.settings.get('MD_EXTENSIONS'):
+    if not gen.settings.get('MARKDOWN'):
         from pelican.settings import DEFAULT_CONFIG
-        gen.settings['MD_EXTENSIONS'] = DEFAULT_CONFIG['MD_EXTENSIONS']
+        gen.settings['MARKDOWN'] = DEFAULT_CONFIG['MARKDOWN']
 
-    if LiquidTags not in gen.settings['MD_EXTENSIONS']:
+    if LiquidTags not in gen.settings['MARKDOWN']:
         configs = dict()
         for key,value in LT_CONFIG.items():
             configs[key]=value
         for key,value in gen.settings.items():
             if key in LT_CONFIG:
                 configs[key]=value
-        gen.settings['MD_EXTENSIONS'].append(LiquidTags(configs))
+        gen.settings['MARKDOWN'].setdefault(
+            'extensions', []
+        ).append(
+            LiquidTags(configs)
+        )
 
 
 def register():

+ 2 - 1
liquid_tags/notebook.py

@@ -51,6 +51,7 @@ import warnings
 import re
 import os
 from functools import partial
+from io import open
 
 from .mdx_liquid_tags import LiquidTags
 
@@ -324,7 +325,7 @@ def notebook(preprocessor, tag, markup):
                             **subcell_kwarg)
 
     # read and parse the notebook
-    with open(nb_path) as f:
+    with open(nb_path, encoding='utf-8') as f:
         nb_text = f.read()
         if IPYTHON_VERSION < 3:
             nb_json = IPython.nbformat.current.reads_json(nb_text)