Skip to content
Permalink
Browse files
Split duplicated math scripts to separate file
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 12, 2017
1 parent 71af9a8 commit da60e7afd3b5cf84a5582d310f59a5539f4ee381
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 52 deletions.
@@ -1,4 +1,5 @@
## -*- coding: utf-8 -*-
<%namespace name="math" file="math_helper.tmpl"/>
<%def name="html_pager()">
%if prevlink or nextlink:
<nav class="postindexpager">
@@ -20,31 +21,6 @@

<%def name="mathjax_script(posts)">
%if any(post.is_mathjax for post in posts):
%if use_katex:
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js" integrity="sha384-/y1Nn9+QQAipbNQWU65krzJralCnuOasHncUFXGkdwntGeSvQicrYkiUBwsgUqc1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js" integrity="sha256-ExtbCSBuYA7kq1Pz362ibde9nnsHYPt6JxuxYeZbU+c=" crossorigin="anonymous"></script>
% if katex_auto_render:
<script>
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
</script>
% else:
<script>
renderMathInElement(document.body);
</script>
% endif
%else:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" integrity="sha256-yYfngbEKv4RENfGDvNUqJTqGFcKf31NJEe9OTnnMH3Y=" crossorigin="anonymous"></script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
${math.math_script()}
%endif
</%def>
@@ -0,0 +1,28 @@
<%def name="math_scripts()">
%if use_katex:
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js" integrity="sha384-/y1Nn9+QQAipbNQWU65krzJralCnuOasHncUFXGkdwntGeSvQicrYkiUBwsgUqc1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js" integrity="sha256-ExtbCSBuYA7kq1Pz362ibde9nnsHYPt6JxuxYeZbU+c=" crossorigin="anonymous"></script>
% if katex_auto_render:
<script>
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
</script>
% else:
<script>
renderMathInElement(document.body);
</script>
% endif
%else:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" integrity="sha256-yYfngbEKv4RENfGDvNUqJTqGFcKf31NJEe9OTnnMH3Y=" crossorigin="anonymous"></script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
</%def>
@@ -1,4 +1,5 @@
## -*- coding: utf-8 -*-
<%namespace name="math" file="math_helper.tmpl"/>

<%def name="meta_translations(post)">
%if len(translations) > 1:
@@ -86,31 +87,6 @@

<%def name="mathjax_script(post)">
%if post.is_mathjax:
%if use_katex:
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js" integrity="sha384-/y1Nn9+QQAipbNQWU65krzJralCnuOasHncUFXGkdwntGeSvQicrYkiUBwsgUqc1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js" integrity="sha256-ExtbCSBuYA7kq1Pz362ibde9nnsHYPt6JxuxYeZbU+c=" crossorigin="anonymous"></script>
% if katex_auto_render:
<script>
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
</script>
% else:
<script>
renderMathInElement(document.body);
</script>
% endif
%else:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" integrity="sha256-yYfngbEKv4RENfGDvNUqJTqGFcKf31NJEe9OTnnMH3Y=" crossorigin="anonymous"></script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
${math.math_script()}
%endif
</%def>

0 comments on commit da60e7a

Please sign in to comment.