Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e0e1698

Browse files
committedApr 24, 2015
q&d conversion to KaTeX
1 parent 4e983b8 commit e0e1698

26 files changed

+319
-368
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ New in master
44
Features
55
--------
66

7+
* Switched from MathJax to KaTeX
78
* New translations (az, fil, tl, uk, zh_TW)
89
* Add reStructuredText transform support (Issue #1647)
910
* Produce Unicode output in ``nikola init`` (via Issue #1644)

‎nikola/data/themes/base-jinja/templates/base_helper.tmpl

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,21 @@ lang="{{ lang }}">
5050
<link rel="next" href="{{ nextlink }}" type="text/html">
5151
{% endif %}
5252

53-
{{ mathjax_config }}
5453
{% if use_cdn %}
5554
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
5655
{% else %}
5756
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
5857
{% endif %}
59-
58+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
59+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
6060
{{ extra_head_data }}
6161
{% endmacro %}
6262

6363
{% macro late_load_js() %}
6464
{{ social_buttons_code }}
65+
<script>
66+
renderMathInElement(document.body);
67+
</script>
6568
{% endmacro %}
6669

6770
{% macro html_stylesheets() %}
@@ -79,6 +82,7 @@ lang="{{ lang }}">
7982
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
8083
{% endif %}
8184
{% endif %}
85+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.css">
8286
{% endmacro %}
8387

8488
{% macro html_feedlinks() %}

‎nikola/data/themes/base-jinja/templates/index.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@
3737
</div>
3838
{{ helper.html_pager() }}
3939
{{ comments.comment_link_script() }}
40-
{{ helper.mathjax_script(posts) }}
4140
{% endblock %}

‎nikola/data/themes/base-jinja/templates/index_helper.tmpl

-8
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,3 @@
1717
</nav>
1818
{% endif %}
1919
{% endmacro %}
20-
21-
{% macro mathjax_script(posts) %}
22-
{% if posts|selectattr("is_mathjax")|list %}
23-
<script type="text/x-mathjax-config">
24-
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
25-
<script src="/assets/js/mathjax.js"></script>
26-
{% endif %}
27-
{% endmacro %}

‎nikola/data/themes/base-jinja/templates/post.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }}
4646
</section>
4747
{% endif %}
48-
{{ helper.mathjax_script(post) }}
4948
</article>
5049
{{ comments.comment_link_script() }}
5150
{% endblock %}

‎nikola/data/themes/base-jinja/templates/post_helper.tmpl

-8
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,3 @@
8383
{% endif %}
8484
{% endif %}
8585
{% endmacro %}
86-
87-
{% macro mathjax_script(post) %}
88-
{% if post.is_mathjax %}
89-
<script type="text/x-mathjax-config">
90-
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
91-
<script src="/assets/js/mathjax.js"></script>
92-
{% endif %}
93-
{% endmacro %}

‎nikola/data/themes/base-jinja/templates/story.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@
1919
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path) }}
2020
</section>
2121
{% endif %}
22-
{{ helper.mathjax_script(post) }}
2322
</article>
2423
{% endblock %}

‎nikola/data/themes/base/assets/js/mathjax.js

-11
This file was deleted.

‎nikola/data/themes/base/templates/base_helper.tmpl

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,21 @@ lang="${lang}">
5050
<link rel="next" href="${nextlink}" type="text/html">
5151
%endif
5252

53-
${mathjax_config}
5453
%if use_cdn:
5554
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
5655
%else:
5756
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
5857
%endif
59-
58+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
59+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
6060
${extra_head_data}
6161
</%def>
6262

6363
<%def name="late_load_js()">
6464
${social_buttons_code}
65+
<script>
66+
renderMathInElement(document.body);
67+
</script>
6568
</%def>
6669

6770
<%def name="html_stylesheets()">
@@ -79,6 +82,7 @@ lang="${lang}">
7982
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
8083
%endif
8184
%endif
85+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.css">
8286
</%def>
8387

8488
<%def name="html_feedlinks()">

‎nikola/data/themes/base/templates/index.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@
3737
</div>
3838
${helper.html_pager()}
3939
${comments.comment_link_script()}
40-
${helper.mathjax_script(posts)}
4140
</%block>

‎nikola/data/themes/base/templates/index_helper.tmpl

-8
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,3 @@
1717
</nav>
1818
%endif
1919
</%def>
20-
21-
<%def name="mathjax_script(posts)">
22-
%if any(post.is_mathjax for post in posts):
23-
<script type="text/x-mathjax-config">
24-
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
25-
<script src="/assets/js/mathjax.js"></script>
26-
%endif
27-
</%def>

‎nikola/data/themes/base/templates/post.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
4646
</section>
4747
% endif
48-
${helper.mathjax_script(post)}
4948
</article>
5049
${comments.comment_link_script()}
5150
</%block>

‎nikola/data/themes/base/templates/post_helper.tmpl

-8
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,3 @@
8383
%endif
8484
%endif
8585
</%def>
86-
87-
<%def name="mathjax_script(post)">
88-
%if post.is_mathjax:
89-
<script type="text/x-mathjax-config">
90-
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
91-
<script src="/assets/js/mathjax.js"></script>
92-
%endif
93-
</%def>

‎nikola/data/themes/base/templates/story.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@
1919
${comments.comment_form(post.permalink(absolute=True), post.title(), post.base_path)}
2020
</section>
2121
%endif
22-
${helper.mathjax_script(post)}
2322
</article>
2423
</%block>

‎nikola/data/themes/bootstrap-jinja/templates/base_helper.tmpl

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ lang="{{ lang }}">
5555
<link rel="next" href="{{ nextlink }}" type="text/html">
5656
{% endif %}
5757

58-
{{ mathjax_config }}
5958
{% if use_cdn %}
6059
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
6160
{% else %}
6261
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
6362
{% endif %}
64-
63+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
64+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
6565
{{ extra_head_data }}
6666
{% endmacro %}
6767

@@ -91,6 +91,9 @@ lang="{{ lang }}">
9191
<script src="/assets/js/colorbox-i18n/jquery.colorbox-{{ colorbox_locales[lang] }}.js"></script>
9292
{% endif %}
9393
{{ social_buttons_code }}
94+
<script>
95+
renderMathInElement(document.body);
96+
</script>
9497
{% endmacro %}
9598

9699

@@ -122,6 +125,7 @@ lang="{{ lang }}">
122125
{% elif not annotations and post and post.meta('annotations') %}
123126
{{ notes.css() }}
124127
{% endif %}
128+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.css">
125129
{% endmacro %}
126130

127131

‎nikola/data/themes/bootstrap-jinja/templates/post.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }}
4646
</section>
4747
{% endif %}
48-
{{ helper.mathjax_script(post) }}
4948
</article>
5049
{{ comments.comment_link_script() }}
5150
{% endblock %}
+6-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
1-
A "website-done-with-bootstrap" theme, so to speak.
1+
A bootstrap3 version of the bootstrap theme.
22

3-
Has a fixed navigation bar at top that displays the NAVIGATION_LINKS
4-
setting and supports nested menus.
3+
There is a variant called bootstrap3-gradients which uses an extra CSS
4+
file for a *visually enhanced experience* (according to Bootstrap
5+
developers at least). This one uses the default bootstrap3 flat look.
56

6-
This theme is used in Nikola's website: http://getnikola.com
7-
8-
Important: To fit in the bootstrap navigation bar, the search form needs the
9-
navbar-form and pull-left CSS classes applied. Here is an example with Nikola's
10-
default duckduckgo search form:
11-
12-
SEARCH_FORM = """
13-
<!-- Custom search -->
14-
<form method="get" id="search" action="http://duckduckgo.com/" class="navbar-form pull-left">
15-
<input type="hidden" name="sites" value="%s"/>
16-
<input type="hidden" name="k8" value="#444444"/>
17-
<input type="hidden" name="k9" value="#D51920"/>
18-
<input type="hidden" name="kt" value="h"/>
19-
<input type="text" name="q" maxlength="255" placeholder="Search&hellip;" class="span2" style="margin-top: 4px;"/>
20-
<input type="submit" value="DuckDuckGo Search" style="visibility: hidden;" />
21-
</form>
22-
<!-- End of custom search -->
23-
""" % SITE_URL
7+
This theme supports Bootswtach font/color schemes (unlike
8+
bootstrap3-gradients) through the `nikola bootswatch_theme` command.

‎nikola/data/themes/bootstrap/engine

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mako
1+
jinja

‎nikola/data/themes/bootstrap/parent

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
base
1+
bootstrap3
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,94 @@
1-
## -*- coding: utf-8 -*-
2-
<%namespace name="base" file="base_helper.tmpl" import="*" />
3-
<%namespace name="notes" file="annotation_helper.tmpl" import="*" />
4-
${set_locale(lang)}
5-
${base.html_headstart()}
6-
<%block name="extra_head">
7-
### Leave this block alone.
8-
</%block>
9-
${template_hooks['extra_head']()}
1+
{# -*- coding: utf-8 -*- #}
2+
{% import 'base_helper.tmpl' as base with context %}
3+
{% import 'annotation_helper.tmpl' as notes with context %}
4+
{{ set_locale(lang) }}
5+
{{ base.html_headstart() }}
6+
{% block extra_head %}
7+
{# Leave this block alone. #}
8+
{% endblock %}
9+
{{ template_hooks['extra_head']() }}
1010
</head>
1111
<body>
12-
<a href="#content" class="sr-only sr-only-focusable">${messages("Skip to main content")}</a>
12+
<a href="#content" class="sr-only sr-only-focusable">{{ messages("Skip to main content") }}</a>
1313

1414
<!-- Menubar -->
1515

16-
<div class="navbar navbar-fixed-top" id="navbar">
17-
<div class="navbar-inner">
18-
<div class="container">
19-
20-
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
21-
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
16+
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
17+
<div class="container"><!-- This keeps the margins nice -->
18+
<div class="navbar-header">
19+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
20+
<span class="sr-only">Toggle navigation</span>
2221
<span class="icon-bar"></span>
2322
<span class="icon-bar"></span>
2423
<span class="icon-bar"></span>
25-
</a>
26-
27-
<a class="brand" href="${abs_link(_link("root", None, lang))}">
28-
%if logo_url:
29-
<img src="${logo_url}" alt="${blog_title}" id="logo">
30-
%endif
24+
</button>
25+
<a class="navbar-brand" href="{{ abs_link(_link("root", None, lang)) }}">
26+
{% if logo_url %}
27+
<img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo">
28+
{% endif %}
3129

32-
% if show_blog_title:
33-
<span id="blog-title">${blog_title}</span>
34-
% endif
30+
{% if show_blog_title %}
31+
<span id="blog-title">{{ blog_title }}</span>
32+
{% endif %}
3533
</a>
36-
<!-- Everything you want hidden at 940px or less, place within here -->
37-
<div class="nav-collapse collapse">
38-
<ul class="nav">
39-
${base.html_navigation_links()}
40-
${template_hooks['menu']()}
41-
</ul>
42-
%if search_form:
43-
${search_form}
44-
%endif
45-
<ul class="nav pull-right">
46-
<%block name="belowtitle">
47-
%if len(translations) > 1:
48-
<li>${base.html_translations()}</li>
49-
%endif
50-
</%block>
51-
% if show_sourcelink:
52-
<li><%block name="sourcelink"></%block></li>
53-
%endif
54-
${template_hooks['menu_alt']()}
55-
</ul>
56-
</div>
57-
</div>
58-
</div>
59-
</div>
34+
</div><!-- /.navbar-header -->
35+
<div class="collapse navbar-collapse navbar-ex1-collapse">
36+
<ul class="nav navbar-nav">
37+
{{ base.html_navigation_links() }}
38+
{{ template_hooks['menu']() }}
39+
</ul>
40+
{% if search_form %}
41+
{{ search_form }}
42+
{% endif %}
43+
44+
<ul class="nav navbar-nav navbar-right">
45+
{% block belowtitle %}
46+
{% if translations|length > 1 %}
47+
<li>{{ base.html_translations() }}</li>
48+
{% endif %}
49+
{% endblock %}
50+
{% if show_sourcelink %}
51+
{% block sourcelink %}{% endblock %}
52+
{% endif %}
53+
{{ template_hooks['menu_alt']() }}
54+
</ul>
55+
</div><!-- /.navbar-collapse -->
56+
</div><!-- /.container -->
57+
</nav>
58+
6059
<!-- End of Menubar -->
61-
<div class="container-fluid" id="content" role="main">
62-
<!--Body content-->
63-
<div class="row-fluid">
64-
<div class="span2"></div>
65-
<div class="span8">
66-
${template_hooks['page_header']()}
67-
<%block name="content"></%block>
68-
</div>
60+
61+
<div class="container" id="content" role="main">
62+
<div class="body-content">
63+
<!--Body content-->
64+
<div class="row">
65+
{{ template_hooks['page_header']() }}
66+
{% block content %}{% endblock %}
67+
</div>
68+
<!--End of body content-->
69+
70+
<footer>
71+
{{ content_footer }}
72+
{{ template_hooks['page_footer']() }}
73+
</footer>
6974
</div>
70-
<!--End of body content-->
71-
</div>
72-
<div class="footerbox">
73-
${content_footer}
74-
${template_hooks['page_footer']()}
7575
</div>
76-
${base.late_load_js()}
76+
77+
{{ base.late_load_js() }}
7778
<script>$('a.image-reference:not(.islink)').colorbox({rel:"gal",maxWidth:"100%",maxHeight:"100%",scalePhotos:true});</script>
7879
<!-- fancy dates -->
7980
<script>
80-
moment.locale("${momentjs_locales[lang]}");
81-
fancydates(${date_fanciness}, ${js_date_format});
81+
moment.locale("{{ momentjs_locales[lang] }}");
82+
fancydates({{ date_fanciness }}, {{ js_date_format }});
8283
</script>
8384
<!-- end fancy dates -->
84-
<%block name="extra_js"></%block>
85-
% if annotations and post and not post.meta('noannotations'):
86-
${notes.code()}
87-
% elif not annotations and post and post.meta('annotations'):
88-
${notes.code()}
89-
% endif
90-
${body_end}
91-
${template_hooks['body_end']()}
85+
{% block extra_js %}{% endblock %}
86+
{% if annotations and post and not post.meta('noannotations') %}
87+
{{ notes.code() }}
88+
{% elif not annotations and post and post.meta('annotations') %}
89+
{{ notes.code() }}
90+
{% endif %}
91+
{{ body_end }}
92+
{{ template_hooks['body_end']() }}
9293
</body>
9394
</html>
Original file line numberDiff line numberDiff line change
@@ -1,171 +1,171 @@
1-
## -*- coding: utf-8 -*-
1+
{# -*- coding: utf-8 -*- #}
22

3-
<%namespace name="notes" file="annotation_helper.tmpl" import="*" />
4-
<%def name="html_headstart()">
3+
{% import 'annotation_helper.tmpl' as notes with context %}
4+
{% macro html_headstart() %}
55
<!DOCTYPE html>
66
<html
7-
\
8-
% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook'):
9-
prefix='\
10-
%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']):
11-
og: http://ogp.me/ns# \
12-
%endif
13-
%if use_open_graph:
14-
article: http://ogp.me/ns/article# \
15-
%endif
16-
%if comment_system == 'facebook':
17-
fb: http://ogp.me/ns/fb# \
18-
%endif
19-
'\
20-
%endif
21-
\
22-
% if is_rtl:
23-
dir="rtl" \
24-
% endif
25-
\
26-
lang="${lang}">
7+
8+
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %}
9+
prefix='
10+
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %}
11+
og: http://ogp.me/ns#
12+
{% endif %}
13+
{% if use_open_graph %}
14+
article: http://ogp.me/ns/article#
15+
{% endif %}
16+
{% if comment_system == 'facebook' %}
17+
fb: http://ogp.me/ns/fb#
18+
{% endif %}
19+
'
20+
{% endif %}
21+
22+
{% if is_rtl %}
23+
dir="rtl"
24+
{% endif %}
25+
26+
lang="{{ lang }}">
2727
<head>
2828
<meta charset="utf-8">
29-
%if description:
30-
<meta name="description" content="${description}">
31-
%endif
32-
<meta name="viewport" content="width=device-width">
33-
<title>${title|striphtml} | ${blog_title|striphtml}</title>
29+
{% if description %}
30+
<meta name="description" content="{{ description }}">
31+
{% endif %}
32+
<meta name="viewport" content="width=device-width, initial-scale=1">
33+
<title>{{ title|e }} | {{ blog_title|e }}</title>
3434

35-
${html_stylesheets()}
36-
${html_feedlinks()}
37-
%if permalink:
38-
<link rel="canonical" href="${abs_link(permalink)}">
39-
%endif
35+
{{ html_stylesheets() }}
36+
{{ html_feedlinks() }}
37+
{% if permalink %}
38+
<link rel="canonical" href="{{ abs_link(permalink) }}">
39+
{% endif %}
4040

41-
%if favicons:
42-
%for name, file, size in favicons:
43-
<link rel="${name}" href="${file}" sizes="${size}"/>
44-
%endfor
45-
%endif
41+
{% if favicons %}
42+
{% for name, file, size in favicons %}
43+
<link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/>
44+
{% endfor %}
45+
{% endif %}
4646

47-
% if comment_system == 'facebook':
48-
<meta property="fb:app_id" content="${comment_system_id}">
49-
% endif
47+
{% if comment_system == 'facebook' %}
48+
<meta property="fb:app_id" content="{{ comment_system_id }}">
49+
{% endif %}
5050

51-
%if prevlink:
52-
<link rel="prev" href="${prevlink}" type="text/html">
53-
%endif
54-
%if nextlink:
55-
<link rel="next" href="${nextlink}" type="text/html">
56-
%endif
51+
{% if prevlink %}
52+
<link rel="prev" href="{{ prevlink }}" type="text/html">
53+
{% endif %}
54+
{% if nextlink %}
55+
<link rel="next" href="{{ nextlink }}" type="text/html">
56+
{% endif %}
5757

58-
${mathjax_config}
59-
%if use_cdn:
58+
{% if use_cdn %}
6059
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
61-
%else:
62-
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
63-
%endif
60+
{% else %}
61+
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
62+
{% endif %}
63+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
64+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
65+
{{ extra_head_data }}
66+
{% endmacro %}
6467

65-
${extra_head_data}
66-
</%def>
67-
68-
69-
<%def name="late_load_js()">
70-
%if use_bundles:
71-
%if use_cdn:
72-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
73-
<script src="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
68+
{% macro late_load_js() %}
69+
{% if use_bundles %}
70+
{% if use_cdn %}
71+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
72+
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
7473
<script src="/assets/js/all.js"></script>
75-
%else:
74+
{% else %}
7675
<script src="/assets/js/all-nocdn.js"></script>
77-
%endif
78-
%else:
79-
%if use_cdn:
80-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
81-
<script src="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
82-
%else:
76+
{% endif %}
77+
{% else %}
78+
{% if use_cdn %}
79+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
80+
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
81+
{% else %}
8382
<script src="/assets/js/jquery.min.js"></script>
8483
<script src="/assets/js/bootstrap.min.js"></script>
8584
<script src="/assets/js/moment-with-locales.min.js"></script>
8685
<script src="/assets/js/fancydates.js"></script>
87-
%endif
86+
{% endif %}
8887
<script src="/assets/js/jquery.colorbox-min.js"></script>
89-
%endif
90-
%if colorbox_locales[lang]:
91-
<script src="/assets/js/colorbox-i18n/jquery.colorbox-${colorbox_locales[lang]}.js"></script>
92-
%endif
93-
${social_buttons_code}
94-
</%def>
88+
{% endif %}
89+
{% if colorbox_locales[lang] %}
90+
<script src="/assets/js/colorbox-i18n/jquery.colorbox-{{ colorbox_locales[lang] }}.js"></script>
91+
{% endif %}
92+
{{ social_buttons_code }}
93+
<script>
94+
renderMathInElement(document.body);
95+
</script>
96+
{% endmacro %}
9597

9698

97-
<%def name="html_stylesheets()">
98-
%if use_bundles:
99-
%if use_cdn:
100-
<link href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
99+
{% macro html_stylesheets() %}
100+
{% if use_bundles %}
101+
{% if use_cdn %}
102+
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
101103
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
102-
%else:
104+
{% else %}
103105
<link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
104-
%endif
105-
%else:
106-
%if use_cdn:
107-
<link href="//maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
108-
%else:
106+
{% endif %}
107+
{% else %}
108+
{% if use_cdn %}
109+
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
110+
{% else %}
109111
<link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
110-
<link href="/assets/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css">
111-
%endif
112+
{% endif %}
112113
<link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
113114
<link href="/assets/css/code.css" rel="stylesheet" type="text/css">
114115
<link href="/assets/css/colorbox.css" rel="stylesheet" type="text/css">
115116
<link href="/assets/css/theme.css" rel="stylesheet" type="text/css">
116-
%if has_custom_css:
117+
{% if has_custom_css %}
117118
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
118-
%endif
119-
%endif
120-
% if annotations and post and not post.meta('noannotations'):
121-
${notes.css()}
122-
% elif not annotations and post and post.meta('annotations'):
123-
${notes.css()}
124-
% endif
125-
</%def>
126-
119+
{% endif %}
120+
{% endif %}
121+
{% if annotations and post and not post.meta('noannotations') %}
122+
{{ notes.css() }}
123+
{% elif not annotations and post and post.meta('annotations') %}
124+
{{ notes.css() }}
125+
{% endif %}
126+
{% endmacro %}
127127

128-
<%def name="html_navigation_links()">
129-
%for url, text in navigation_links[lang]:
130-
% if isinstance(url, tuple):
131-
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">${text}<b class="caret"></b></a>
128+
{% macro html_navigation_links() %}
129+
{% for url, text in navigation_links[lang] %}
130+
{% if isinstance(url, tuple) %}
131+
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ text }}<b class="caret"></b></a>
132132
<ul class="dropdown-menu">
133-
%for suburl, text in url:
134-
% if rel_link(permalink, suburl) == "#":
135-
<li class="active"><a href="${permalink}">${text}</a>
136-
%else:
137-
<li><a href="${suburl}">${text}</a>
138-
%endif
139-
%endfor
133+
{% for suburl, text in url %}
134+
{% if rel_link(permalink, suburl) == "#" %}
135+
<li class="active"><a href="{{ permalink }}">{{ text }}</a>
136+
{% else %}
137+
<li><a href="{{ suburl }}">{{ text }}</a>
138+
{% endif %}
139+
{% endfor %}
140140
</ul>
141-
% else:
142-
% if rel_link(permalink, url) == "#":
143-
<li class="active"><a href="${permalink}">${text}</a>
144-
%else:
145-
<li><a href="${url}">${text}</a>
146-
%endif
147-
% endif
148-
%endfor
149-
</%def>
141+
{% else %}
142+
{% if rel_link(permalink, url) == "#" %}
143+
<li class="active"><a href="{{ permalink }}">{{ text }}</a>
144+
{% else %}
145+
<li><a href="{{ url }}">{{ text }}</a>
146+
{% endif %}
147+
{% endif %}
148+
{% endfor %}
149+
{% endmacro %}
150150

151-
<%def name="html_feedlinks()">
152-
%if rss_link:
153-
${rss_link}
154-
%elif generate_rss:
155-
%if len(translations) > 1:
156-
%for language in translations:
157-
<link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
158-
%endfor
159-
%else:
160-
<link rel="alternate" type="application/rss+xml" title="RSS" href="${_link('rss', None)}">
161-
%endif
162-
%endif
163-
</%def>
151+
{% macro html_feedlinks() %}
152+
{% if rss_link %}
153+
{{ rss_link }}
154+
{% elif generate_rss %}
155+
{% if translations|length > 1 %}
156+
{% for language in translations %}
157+
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}">
158+
{% endfor %}
159+
{% else %}
160+
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}">
161+
{% endif %}
162+
{% endif %}
163+
{% endmacro %}
164164

165-
<%def name="html_translations()">
166-
%for langname in translations.keys():
167-
%if langname != lang:
168-
<li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li>
169-
%endif
170-
%endfor
171-
</%def>
165+
{% macro html_translations() %}
166+
{% for langname in translations.keys() %}
167+
{% if langname != lang %}
168+
<li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li>
169+
{% endif %}
170+
{% endfor %}
171+
{% endmacro %}
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
## -*- coding: utf-8 -*-
2-
<%inherit file="base.tmpl"/>
3-
<%namespace name="comments" file="comments_helper.tmpl"/>
4-
<%namespace name="ui" file="crumbs.tmpl" import="bar"/>
5-
<%block name="sourcelink"></%block>
1+
{# -*- coding: utf-8 -*- #}
2+
{% extends 'base.tmpl' %}
3+
{% import 'comments_helper.tmpl' as comments with context %}
4+
{% import 'crumbs.tmpl' as ui with context %}
5+
{% block sourcelink %}{% endblock %}
66

7-
<%block name="content">
8-
${ui.bar(crumbs)}
9-
%if title:
10-
<h1>${title|h}</h1>
11-
%endif
12-
%if post:
7+
{% block content %}
8+
{{ ui.bar(crumbs) }}
9+
{% if title %}
10+
<h1>{{ title|e }}</h1>
11+
{% endif %}
12+
{% if post %}
1313
<p>
14-
${post.text()}
14+
{{ post.text() }}
1515
</p>
16-
%endif
17-
%if folders:
16+
{% endif %}
17+
{% if folders %}
1818
<ul>
19-
% for folder, ftitle in folders:
20-
<li><a href="${folder}"><i class="icon-folder-open"></i>&nbsp;${ftitle}</a></li>
21-
% endfor
19+
{% for folder, ftitle in folders %}
20+
<li><a href="{{ folder }}"><i class="glyphicon glyphicon-folder-open"></i>&nbsp;{{ ftitle }}</a></li>
21+
{% endfor %}
2222
</ul>
23-
%endif
23+
{% endif %}
2424

2525
<div id="gallery_container"></div>
26-
%if photo_array:
26+
{% if photo_array %}
2727
<noscript>
2828
<ul class="thumbnails">
29-
%for image in photo_array:
30-
<li><a href="${image['url']}" class="thumbnail image-reference" title="${image['title']}">
31-
<img src="${image['url_thumb']}" alt="${image['title']}" /></a>
32-
%endfor
29+
{% for image in photo_array %}
30+
<li><a href="{{ image['url'] }}" class="thumbnail image-reference" title="{{ image['title'] }}">
31+
<img src="{{ image['url_thumb'] }}" alt="{{ image['title'] }}" /></a>
32+
{% endfor %}
3333
</ul>
3434
</noscript>
35-
%endif
36-
%if site_has_comments and enable_comments:
37-
${comments.comment_form(None, permalink, title)}
38-
%endif
39-
</%block>
35+
{% endif %}
36+
{% if site_has_comments and enable_comments %}
37+
{{ comments.comment_form(None, permalink, title) }}
38+
{% endif %}
39+
{% endblock %}
4040

41-
<%block name="extra_head">
42-
${parent.extra_head()}
41+
{% block extra_head %}
42+
{{ super() }}
4343
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
4444
<style type="text/css">
4545
.image-block {
@@ -49,16 +49,16 @@ ${parent.extra_head()}
4949
width: 100%;
5050
}
5151
</style>
52-
</%block>
52+
{% endblock %}
5353

5454

55-
<%block name="extra_js">
55+
{% block extra_js %}
5656
<script src="/assets/js/flowr.plugin.js"></script>
5757
<script>
58-
jsonContent = ${photo_array_json};
58+
jsonContent = {{ photo_array_json }};
5959
$("#gallery_container").flowr({
6060
data : jsonContent,
61-
height : ${thumbnail_size}*.6,
61+
height : {{ thumbnail_size }}*.6,
6262
padding: 5,
6363
rows: -1,
6464
render : function(params) {
@@ -91,4 +91,4 @@ $("#gallery_container").flowr({
9191
});
9292
$("a.image-reference").colorbox({rel:"gal", maxWidth:"100%",maxHeight:"100%",scalePhotos:true});
9393
</script>
94-
</%block>
94+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
## -*- coding: utf-8 -*-
2-
<%inherit file="base.tmpl"/>
3-
<%namespace name="ui" file="crumbs.tmpl" import="bar"/>
1+
{# -*- coding: utf-8 -*- #}
2+
{% extends 'base.tmpl' %}
3+
{% import 'crumbs.tmpl' as ui with context %}
44

5-
<%block name="content">
6-
${ui.bar(crumbs)}
7-
%if folders or files:
5+
{% block content %}
6+
{{ ui.bar(crumbs) }}
7+
{% if folders or files %}
88
<ul class="list-unstyled">
9-
% for name in folders:
10-
<li><a href="${name}"><i class="icon-folder-open"></i> ${name}</a>
11-
% endfor
12-
% for name in files:
13-
<li><a href="${name}.html"><i class="icon-file"></i> ${name}</a>
14-
% endfor
9+
{% for name in folders %}
10+
<li><a href="{{ name }}"><i class="glyphicon glyphicon-folder-open"></i> {{ name }}</a>
11+
{% endfor %}
12+
{% for name in files %}
13+
<li><a href="{{ name }}.html"><i class="glyphicon glyphicon-file"></i> {{ name }}</a>
14+
{% endfor %}
1515
</ul>
16-
%endif
17-
% if code:
18-
${code}
19-
% endif
20-
</%block>
16+
{% endif %}
17+
{% if code %}
18+
{{ code }}
19+
{% endif %}
20+
{% endblock %}
2121

22-
<%block name="sourcelink">
23-
% if source_link:
22+
{% block sourcelink %}
23+
{% if source_link %}
2424
<li>
25-
<a href="${source_link}" id="sourcelink">${messages("Source")}</a>
25+
<a href="{{ source_link }}" id="sourcelink">{{ messages("Source") }}</a>
2626
</li>
27-
% endif
28-
</%block>
27+
{% endif %}
28+
{% endblock %}

‎nikola/data/themes/bootstrap/templates/post.tmpl

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
4646
</section>
4747
% endif
48-
${helper.mathjax_script(post)}
4948
</article>
5049
${comments.comment_link_script()}
5150
</%block>
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
<%block name="content">
2-
<div id="${carousel_id}" class="carousel slide">
1+
{% block content %}
2+
<div id="{{ carousel_id }}" class="carousel slide">
33
<ol class="carousel-indicators">
4-
% for i in range(len(slides_content)):
5-
% if i == 0:
6-
<li data-target="#${carousel_id}" data-slide-to="${i}" class="active"></li>
7-
% else:
8-
<li data-target="#${carousel_id}" data-slide-to="${i}"></li>
9-
% endif
10-
% endfor
4+
{% for i in range(slides_content|length) %}
5+
{% if i == 0 %}
6+
<li data-target="#{{ carousel_id }}" data-slide-to="{{ i }}" class="active"></li>
7+
{% else %}
8+
<li data-target="#{{ carousel_id }}" data-slide-to="{{ i }}"></li>
9+
{% endif %}
10+
{% endfor %}
1111
</ol>
1212
<div class="carousel-inner">
13-
% for i, image in enumerate(slides_content):
14-
% if i == 0:
15-
<div class="item active"><img src="${image}" alt="" style="margin: 0 auto 0 auto;"></div>
16-
% else:
17-
<div class="item"><img src="${image}" alt="" style="margin: 0 auto 0 auto;"></div>
18-
% endif
19-
% endfor
13+
{% for i, image in enumerate(slides_content) %}
14+
{% if i == 0 %}
15+
<div class="item active"><img src="{{ image }}" alt="" style="margin: 0 auto 0 auto;"></div>
16+
{% else %}
17+
<div class="item"><img src="{{ image }}" alt="" style="margin: 0 auto 0 auto;"></div>
18+
{% endif %}
19+
{% endfor %}
2020
</div>
21-
<a class="left carousel-control" href="#${carousel_id}" data-slide="prev">&lsaquo;</a>
22-
<a class="right carousel-control" href="#${carousel_id}" data-slide="next">&rsaquo;</a>
21+
<a class="left carousel-control" href="#{{ carousel_id }}" data-slide="prev"><span class="icon-prev"></span></a>
22+
<a class="right carousel-control" href="#{{ carousel_id }}" data-slide="next"><span class="icon-next"></span></a>
2323
</div>
24-
</%block>
24+
{% endblock %}

‎nikola/data/themes/bootstrap3/templates/base_helper.tmpl

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ lang="${lang}">
5555
<link rel="next" href="${nextlink}" type="text/html">
5656
%endif
5757

58-
${mathjax_config}
5958
%if use_cdn:
6059
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
6160
%else:
6261
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
6362
%endif
64-
63+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
64+
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
6565
${extra_head_data}
6666
</%def>
6767

@@ -90,6 +90,9 @@ lang="${lang}">
9090
<script src="/assets/js/colorbox-i18n/jquery.colorbox-${colorbox_locales[lang]}.js"></script>
9191
%endif
9292
${social_buttons_code}
93+
<script>
94+
renderMathInElement(document.body);
95+
</script>
9396
</%def>
9497

9598

0 commit comments

Comments
 (0)
Please sign in to comment.