Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getnikola/nikola
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5d129e1efba6
Choose a base ref
...
head repository: getnikola/nikola
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 94eccde8143f
Choose a head ref
  • 3 commits
  • 10 files changed
  • 1 contributor

Commits on Apr 12, 2017

  1. Reword math-related stuff in conf.py.in

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Apr 12, 2017
    Copy the full SHA
    fe5b607 View commit details
  2. Add new math stuff to story.tmpl and bootstrap3

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Apr 12, 2017
    Copy the full SHA
    867dcac View commit details
  3. Jinjify math_helper changes

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Apr 12, 2017
    Copy the full SHA
    94eccde View commit details
6 changes: 4 additions & 2 deletions nikola/conf.py.in
Original file line number Diff line number Diff line change
@@ -953,7 +953,9 @@ PRETTY_URLS = ${PRETTY_URLS}
# Do you want a add a Mathjax config file?
# MATHJAX_CONFIG = ""

# If you are using the compile-ipynb plugin, just add this one:
# If you are using Jupyter Notebooks, or want support for the $.$
# syntax (not recommended due to confusion with running text!), just add this
# one:
# MATHJAX_CONFIG = """
# <script type="text/x-mathjax-config">
# MathJax.Hub.Config({
@@ -975,7 +977,7 @@ PRETTY_URLS = ${PRETTY_URLS}
# USE_KATEX = False

# If you want to use the old (buggy) inline math $.$ with KaTeX, then
# you might want to use this feature.
# you might want to use this config.
# KATEX_AUTO_RENDER = """
# delimiters: [
# {left: "$$", right: "$$", display: true},
4 changes: 3 additions & 1 deletion nikola/data/themes/base-jinja/templates/index.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{# -*- coding: utf-8 -*- #}
{% import 'index_helper.tmpl' as helper with context %}
{% import 'math_helper.tmpl' as math with context %}
{% import 'comments_helper.tmpl' as comments with context %}
{% import 'pagination_helper.tmpl' as pagination with context %}
{% extends 'base.tmpl' %}
@@ -9,6 +10,7 @@
{% if posts and (permalink == '/' or permalink == '/' + index_file) %}
<link rel="prefetch" href="{{ posts[0].permalink() }}" type="text/html">
{% endif %}
{{ math.math_styles_ifposts(posts) }}
{% endblock %}

{% block content %}
@@ -51,5 +53,5 @@
</div>
{{ helper.html_pager() }}
{{ comments.comment_link_script() }}
{{ helper.mathjax_script(posts) }}
{{ math.math_scripts_ifposts(posts) }}
{% endblock %}
30 changes: 2 additions & 28 deletions nikola/data/themes/base-jinja/templates/index_helper.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{# -*- coding: utf-8 -*- #}
{% import 'math_helper.tmpl' as math with context %}
{% macro html_pager() %}
{% if prevlink or nextlink %}
<nav class="postindexpager">
@@ -19,32 +20,5 @@
{% endmacro %}

{% macro mathjax_script(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
{% 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 %}
{% endif %}
{{ math.math_scripts_ifposts(posts) }}
{% endmacro %}
58 changes: 58 additions & 0 deletions nikola/data/themes/base-jinja/templates/math_helper.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% macro 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 %}
{% endmacro %}

{% macro math_styles() %}
{% if use_katex %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
{% endif %}
{% endmacro %}

{% macro math_scripts_ifpost(post) %}
{% if post.is_mathjax %}
{{ math_scripts() }}
{% endif %}
{% endmacro %}

{% macro math_scripts_ifposts(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
{{ math_scripts() }}
{% endif %}
{% endmacro %}

{% macro math_styles_ifpost(post) %}
{% if post.is_mathjax %}
{{ math_styles() }}
{% endif %}
{% endmacro %}

{% macro math_styles_ifposts(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
{{ math_styles() }}
{% endif %}
{% endmacro %}
4 changes: 3 additions & 1 deletion nikola/data/themes/base-jinja/templates/post.tmpl
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
{% import 'post_helper.tmpl' as helper with context %}
{% import 'post_header.tmpl' as pheader with context %}
{% import 'comments_helper.tmpl' as comments with context %}
{% import 'math_helper.tmpl' as math with context %}
{% extends 'base.tmpl' %}

{% block extra_head %}
@@ -22,6 +23,7 @@
{{ helper.open_graph_metadata(post) }}
{{ helper.twitter_card_information(post) }}
{{ helper.meta_translations(post) }}
{{ math.math_styles_ifpost(post) }}
{% endblock %}

{% block content %}
@@ -42,7 +44,7 @@
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }}
</section>
{% endif %}
{{ helper.mathjax_script(post) }}
{{ math.math_styles_ifpost(post) }}
</article>
{{ comments.comment_link_script() }}
{% endblock %}
30 changes: 2 additions & 28 deletions nikola/data/themes/base-jinja/templates/post_helper.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{# -*- coding: utf-8 -*- #}
{% import 'math_helper.tmpl' as math with context %}

{% macro meta_translations(post) %}
{% if translations|length > 1 %}
@@ -85,32 +86,5 @@
{% endmacro %}

{% macro 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 %}
{% endif %}
{{ math.math_scripts_ifpost(post) }}
{% endmacro %}
3 changes: 2 additions & 1 deletion nikola/data/themes/base-jinja/templates/story.tmpl
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
{% import 'post_helper.tmpl' as helper with context %}
{% import 'post_header.tmpl' as pheader with context %}
{% import 'comments_helper.tmpl' as comments with context %}
{% import 'math_helper.tmpl' as math with context %}
{% extends 'post.tmpl' %}

{% block content %}
@@ -19,6 +20,6 @@
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path) }}
</section>
{% endif %}
{{ helper.mathjax_script(post) }}
{{ math.math_scripts_ifpost(post) }}
</article>
{% endblock %}
3 changes: 2 additions & 1 deletion nikola/data/themes/base/templates/story.tmpl
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%inherit file="post.tmpl"/>

<%block name="content">
@@ -19,6 +20,6 @@
${comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path)}
</section>
%endif
${helper.mathjax_script(post)}
${math.math_scripts_ifpost(post)}
</article>
</%block>
4 changes: 3 additions & 1 deletion nikola/data/themes/bootstrap3-jinja/templates/post.tmpl
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
{% import 'post_helper.tmpl' as helper with context %}
{% import 'post_header.tmpl' as pheader with context %}
{% import 'comments_helper.tmpl' as comments with context %}
{% import 'math_helper.tmpl' as math with context %}
{% extends 'base.tmpl' %}

{% block extra_head %}
@@ -22,6 +23,7 @@
{{ helper.open_graph_metadata(post) }}
{{ helper.twitter_card_information(post) }}
{{ helper.meta_translations(post) }}
{{ math.math_styles_ifpost(post) }}
{% endblock %}

{% block content %}
@@ -42,7 +44,7 @@
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }}
</section>
{% endif %}
{{ helper.mathjax_script(post) }}
{{ math.math_scripts_ifpost(post) }}
</article>
{{ comments.comment_link_script() }}
{% endblock %}
4 changes: 3 additions & 1 deletion nikola/data/themes/bootstrap3/templates/post.tmpl
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%inherit file="base.tmpl"/>

<%block name="extra_head">
@@ -22,6 +23,7 @@
${helper.open_graph_metadata(post)}
${helper.twitter_card_information(post)}
${helper.meta_translations(post)}
${math.math_styles_ifpost(post)}
</%block>

<%block name="content">
@@ -42,7 +44,7 @@
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
</section>
% endif
${helper.mathjax_script(post)}
${math.math_scripts_ifpost(post)}
</article>
${comments.comment_link_script()}
</%block>