|
@@ -114,7 +114,7 @@ def process_settings(pelicanobj):
|
|
|
|
|
|
if key == 'process_escapes' and isinstance(value, bool):
|
|
|
mathjax_settings[key] = 'true' if value else 'false'
|
|
|
-
|
|
|
+
|
|
|
if key == 'latex_preview':
|
|
|
try:
|
|
|
typeVal = isinstance(value, basestring)
|
|
@@ -125,7 +125,7 @@ def process_settings(pelicanobj):
|
|
|
continue
|
|
|
|
|
|
mathjax_settings[key] = value
|
|
|
-
|
|
|
+
|
|
|
if key == 'color':
|
|
|
try:
|
|
|
typeVal = isinstance(value, basestring)
|
|
@@ -136,23 +136,23 @@ def process_settings(pelicanobj):
|
|
|
continue
|
|
|
|
|
|
mathjax_settings[key] = value
|
|
|
-
|
|
|
+
|
|
|
if key == 'linebreak_automatic' and isinstance(value, bool):
|
|
|
mathjax_settings[key] = 'true' if value else 'false'
|
|
|
-
|
|
|
+
|
|
|
if key == 'process_summary' and isinstance(value, bool):
|
|
|
if value and BeautifulSoup is None:
|
|
|
print("BeautifulSoup4 is needed for summaries to be processed by render_math\nPlease install it")
|
|
|
value = False
|
|
|
|
|
|
mathjax_settings[key] = value
|
|
|
-
|
|
|
+
|
|
|
if key == 'responsive' and isinstance(value, bool):
|
|
|
mathjax_settings[key] = 'true' if value else 'false'
|
|
|
|
|
|
- if key == 'force_tls' and isinstance(value, bool):
|
|
|
+ if key == 'force_tls' and isinstance(value, bool):
|
|
|
mathjax_settings[key] = 'true' if value else 'false'
|
|
|
-
|
|
|
+
|
|
|
if key == 'responsive_break' and isinstance(value, int):
|
|
|
mathjax_settings[key] = str(value)
|
|
|
|
|
@@ -205,7 +205,7 @@ def process_summary(article):
|
|
|
full_text = content_parsed.find_all(class_='math')[len(math)-1].get_text()
|
|
|
math[-1].string = "%s ..." % full_text
|
|
|
summary = summary_parsed.decode()
|
|
|
-
|
|
|
+
|
|
|
article._summary = "%s<script type='text/javascript'>%s</script>" % (summary, process_summary.mathjax_script)
|
|
|
|
|
|
def configure_typogrify(pelicanobj, mathjax_settings):
|
|
@@ -242,7 +242,7 @@ def configure_typogrify(pelicanobj, mathjax_settings):
|
|
|
|
|
|
def process_mathjax_script(mathjax_settings):
|
|
|
"""Load the mathjax script template from file, and render with the settings"""
|
|
|
-
|
|
|
+
|
|
|
# Read the mathjax javascript template from file
|
|
|
with open (os.path.dirname(os.path.realpath(__file__))
|
|
|
+ '/mathjax_script_template', 'r') as mathjax_script_template:
|
|
@@ -319,10 +319,10 @@ def process_rst_and_summaries(content_generators):
|
|
|
"""
|
|
|
Ensure mathjax script is applied to RST and summaries are
|
|
|
corrected if specified in user settings.
|
|
|
-
|
|
|
+
|
|
|
Handles content attached to ArticleGenerator and PageGenerator objects,
|
|
|
since the plugin doesn't know how to handle other Generator types.
|
|
|
-
|
|
|
+
|
|
|
For reStructuredText content, examine both articles and pages.
|
|
|
If article or page is reStructuredText and there is math present,
|
|
|
append the mathjax script.
|
|
@@ -330,7 +330,7 @@ def process_rst_and_summaries(content_generators):
|
|
|
Also process summaries if present (only applies to articles)
|
|
|
and user wants summaries processed (via user settings)
|
|
|
"""
|
|
|
-
|
|
|
+
|
|
|
for generator in content_generators:
|
|
|
if isinstance(generator, generators.ArticlesGenerator):
|
|
|
for article in generator.articles:
|