Closed lsandig closed 9 years ago
This seems like a problem with RST. Can you try the above with Markdown? If it produces a problem, then I can fix it.
But I suspect in this case, you will need to insert the mathjax script into the template manually. Look for one of the options (check the README) for what I mean.
I am going to close this issue, but if you have the same issue with Markdown, please re-open
As you suspected it works with Markdown. I will try to work around this in my templates. Thanks for the quick reply!
Hi @lsandig
Unfortunately, it is a deficiency in RST. If you like, try making contact with the makers of RST and ask them to fix this. Thanks for the info regarding the markdown, now I can breathe easier.
Hi @barrysteyn
I think I found a fix:
In line 336 of math.py
you are looping through all ArticlesGenerator.articles
for article in generator.articles:
rst_add_mathjax(article)
# [snip]
But this list only contains original language articles, translations are kept separately in ArticlesGenerator.translations
Looping through both of them made it insert the mathjax_script
also in translated articles for me:
for article in generator.articles + generator.translations:
rst_add_mathjax(article)
# [snip]
I hope this helps (although my knowledge of the pelican internals is limited).
Hi @lsandig
Thanks for this. Why does it still work in Markdown though? If I roll out a fix, can you test it for me?
@lsandig
I have made your requested change, can you look at it and tell me if things are kosher. If you are happy, I will submit it to the official pelican plugin repo.
@barrysteyn I just tested your change and it works. Thanks again!
Hello. When an article has a translation, the mathjax
<script>
will only be inserted in the original. You can test this with the following MWE (DEFAULT_LANG='de'
inpelicanconf.py
):File "mj_test_de.rst"
File "mj_test_en.rst"
In both cases the inline math will be wrapped in
<math>
tags, but only the "de" version gets the mathjax javascript and renders accordingly. The "en" translation just shows the LaTeX code.