Просмотр исходного кода

Corrected documentation, and also fixed bug where using unicode strings would not get recognized (thanks to TheNeuralBit)

Barry Steyn лет назад: 10
Родитель
Сommit
85a51f6b81
2 измененных файлов с 5 добавлено и 5 удалено
  1. 2 2
      render_math/Readme.md
  2. 3 3
      render_math/math.py

+ 2 - 2
render_math/Readme.md

@@ -37,7 +37,7 @@ the plugin and start writing your Math.
 
 
 ### Settings
 ### Settings
 Certain MathJax rendering options can be set. These options 
 Certain MathJax rendering options can be set. These options 
-are in a dictionary variable called `MATH` in the pelican
+are in a dictionary variable called `MATH_JAX` in the pelican
 settings file.
 settings file.
 
 
 The dictionary can be set with the following keys:
 The dictionary can be set with the following keys:
@@ -58,7 +58,7 @@ rendering LaTex. If set to `Tex`, then the TeX code is used as the preview
 For example, in settings.py, the following would make math render in blue and
 For example, in settings.py, the following would make math render in blue and
 displaymath align to the left:
 displaymath align to the left:
 
 
-    MATH = {'color':'blue','align':left}
+    MATH_JAX = {'color':'blue','align':left}
 
 
 #### Resulting HTML
 #### Resulting HTML
 Inlined math is wrapped in `span` tags, while displayed math is wrapped in `div` tags.
 Inlined math is wrapped in `span` tags, while displayed math is wrapped in `div` tags.

+ 3 - 3
render_math/math.py

@@ -68,7 +68,7 @@ def process_settings(pelicanobj):
     for key, value in ((key, settings[key]) for key in settings):
     for key, value in ((key, settings[key]) for key in settings):
         # Iterate over dictionary in a way that is compatible with both version 2
         # Iterate over dictionary in a way that is compatible with both version 2
         # and 3 of python
         # and 3 of python
-        if key == 'align' and isinstance(value, str):
+        if key == 'align' and isinstance(value, basestring):
             if value == 'left' or value == 'right' or value == 'center':
             if value == 'left' or value == 'right' or value == 'center':
                 mathjax_settings[key] = value
                 mathjax_settings[key] = value
             else:
             else:
@@ -83,10 +83,10 @@ def process_settings(pelicanobj):
         if key == 'process_escapes' and isinstance(value, bool):
         if key == 'process_escapes' and isinstance(value, bool):
             mathjax_settings[key] = 'true' if value else 'false'
             mathjax_settings[key] = 'true' if value else 'false'
 
 
-        if key == 'latex_preview' and isinstance(value, str):
+        if key == 'latex_preview' and isinstance(value, basestring):
             mathjax_settings[key] = value
             mathjax_settings[key] = value
 
 
-        if key == 'color' and isinstance(value, str):
+        if key == 'color' and isinstance(value, basestring):
             mathjax_settings[key] = value
             mathjax_settings[key] = value
 
 
     return mathjax_settings
     return mathjax_settings