On 18 September 2016 at 07:31, Drini Pedro <drini.s...@gmail.com> wrote:
> I found out that material-theme has problems with matjax.
> [snip]
> templates/post.tmpl calls {{ helper.mathjax_script(post) }}  from   
> post_helper.tmpl
> and there the math-related part is
> {% macro mathjax_script(post) %}
>     {% if post.is_mathjax %}
>         <script type="text/x-mathjax-config">
>         MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], 
> ['\\(','\\)']]}});</script>
>         <script src="/assets/js/mathjax.js"></script>
>     {% endif %}
> {% endmacro %}

This snippet is outdated. I fixed it.

> but there is no index_htlper.tmpl)
> but post_helper.tmpl does not exist! yet arusahni_helper defines

You see, there is an inheritance chain. Every theme in Nikola inherits
from another theme. And some of the most basic services are provided
by the `base` and `base-jinja` themes. So for example, material-theme
inherits from bootstrap3-jinja, which in turn inherits from
base-jinja. If a template file does not exist in material-theme,
Nikola will then try looking for it in bootstrap3-jinja and
base-jinja. This allows for simple customization of themes and not
copy-pasting the same files around. (For example, our comments
templates are only in base/base-jinja, and yet every theme uses them)

So, when material-theme asks for index_helper.tmpl, it doesn’t exist
in material-theme, so we dig further. We check bootstrap3-jinja, but
it doesn’t have it too. We then resort to base-jinja, which has this
template, and all works well.

(mathjax_config is a configuration variable available to all
templates, not a function)

I updated material-theme with a newer version of the mathjax snippet.
Run `nikola theme -i material-theme` to install the new version of
this theme.

Chris Warrick <https://chriswarrick.com/>

You received this message because you are subscribed to the Google Groups 
"nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nikola-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to