Kaynağa Gözat

Merge pull request #787 from Krastanov/patch-1

render_math: Fix for new MARKDOWN dict in Pelican 3.7
Justin Mayer 7 yıl önce
ebeveyn
işleme
b726362942
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4 1
      render_math/math.py

+ 4 - 1
render_math/math.py

@@ -269,7 +269,10 @@ def mathjax_for_markdown(pelicanobj, mathjax_script, mathjax_settings):
 
     # Instantiate markdown extension and append it to the current extensions
     try:
-        pelicanobj.settings['MD_EXTENSIONS'].append(PelicanMathJaxExtension(config))
+        if isinstance(pelicanobj.settings.get('MD_EXTENSIONS'), list): # pelican 3.6.3 and earlier
+            pelicanobj.settings['MD_EXTENSIONS'].append(PelicanMathJaxExtension(config))
+        else:
+            pelicanobj.settings['MARKDOWN'].setdefault('extensions', []).append(PelicanMathJaxExtension(config))
     except:
         sys.excepthook(*sys.exc_info())
         sys.stderr.write("\nError - the pelican mathjax markdown extension failed to configure. MathJax is non-functional.\n")