Skip to content

Commit

Permalink
Jinjify
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 12, 2015
1 parent 666459e commit 7122250
Show file tree
Hide file tree
Showing 26 changed files with 92 additions and 80 deletions.
8 changes: 4 additions & 4 deletions nikola/data/themes/base-jinja/templates/author.tmpl
Expand Up @@ -5,10 +5,10 @@
{{ super() }}
{% if translations|length > 1 and generate_rss %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ author }} ({{ language }})" href="{{ _link(kind + "_rss", author, language) }}">
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ author|e }} ({{ language }})" href="{{ _link(kind + "_rss", author, language) }}">
{% endfor %}
{% elif generate_rss %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ author }}" href="{{ _link(kind + "_rss", author) }}">
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ author|e }}" href="{{ _link(kind + "_rss", author) }}">
{% endif %}
{% endblock %}

Expand All @@ -18,7 +18,7 @@
<header>
<h1>{{ title|e }}</h1>
{% if description %}
<p>{{ description }}</p>
<p>{{ description|e }}</p>
{% endif %}
<div class="metadata">
{% if translations|length > 1 and generate_rss %}
Expand All @@ -35,7 +35,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></li>
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/authorindex.tmpl
Expand Up @@ -5,9 +5,9 @@
{{ super() }}
{% if tranlations|length > 1 and generate_atom %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author }} section ({{ language }})" href="{{ _link(kind + "_atom", author, language) }}">
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author|e }} section ({{ language }})" href="{{ _link(kind + "_atom", author, language) }}">
{% endfor %}
{% elif generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author }} section" href="{{ _link("author" + "_atom", author) }}">
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author|e }} section" href="{{ _link("author" + "_atom", author) }}">
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/authors.tmpl
Expand Up @@ -8,7 +8,7 @@
<ul class="postlist">
{% for text, link in items %}
{% if text not in hidden_authors %}
<li><a class="reference listtitle" href="{{ link }}">{{ text }}</a></li>
<li><a class="reference listtitle" href="{{ link }}">{{ text|e }}</a></li>
{% endif %}
{% endfor %}
</ul>
Expand Down
16 changes: 8 additions & 8 deletions nikola/data/themes/base-jinja/templates/base_header.tmpl
Expand Up @@ -16,13 +16,13 @@
{% endmacro %}

{% macro html_site_title() %}
<h1 id="brand"><a href="{{ abs_link(_link("root", None, lang)) }}" title="{{ blog_title }}" rel="home">
<h1 id="brand"><a href="{{ abs_link(_link("root", None, lang)) }}" title="{{ blog_title|e }}" rel="home">
{% if logo_url %}
<img src="{{ logo_url }}" alt="{{ blog_title }}" id="logo">
<img src="{{ logo_url }}" alt="{{ blog_title|e }}" id="logo">
{% endif %}

{% if show_blog_title %}
<span id="blog-title">{{ blog_title }}</span>
<span id="blog-title">{{ blog_title|e }}</span>
{% endif %}
</a></h1>
{% endmacro %}
Expand All @@ -32,21 +32,21 @@
<ul>
{% for url, text in navigation_links[lang] %}
{% if isinstance(url, tuple) %}
<li> {{ text }}
<li> {{ text|e }}
<ul>
{% for suburl, text in url %}
{% if rel_link(permalink, suburl) == "#" %}
<li class="active"><a href="{{ permalink }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li>
<li class="active"><a href="{{ permalink }}">{{ text|e }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li>
{% else %}
<li><a href="{{ suburl }}">{{ text }}</a></li>
<li><a href="{{ suburl }}">{{ text|e }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% else %}
{% if rel_link(permalink, url) == "#" %}
<li class="active"><a href="{{ permalink }}">{{ text }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li>
<li class="active"><a href="{{ permalink }}">{{ text|e }} <span class="sr-only">{{ messages("(active)", lang) }}</span></a></li>
{% else %}
<li><a href="{{ url }}">{{ text }}</a></li>
<li><a href="{{ url }}">{{ text|e }}</a></li>
{% endif %}
{% endif %}
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/base_helper.tmpl
Expand Up @@ -25,7 +25,7 @@ lang="{{ lang }}">
<base href="{{ abs_link(permalink) }}">
{% endif %}
{% if description %}
<meta name="description" content="{{ description }}">
<meta name="description" content="{{ description|e }}">
{% endif %}
<meta name="viewport" content="width=device-width">
{% if title == blog_title %}
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base-jinja/templates/gallery.tmpl
Expand Up @@ -17,16 +17,16 @@
{% if folders %}
<ul>
{% for folder, ftitle in folders %}
<li><a href="{{ folder }}"><i
class="icon-folder-open"></i>&nbsp;{{ ftitle }}</a></li>
<li><a href="{{ folder|urlencode }}"><i
class="icon-folder-open"></i>&nbsp;{{ ftitle|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if photo_array %}
<ul class="thumbnails">
{% for image in photo_array %}
<li><a href="{{ image['url'] }}" class="thumbnail image-reference" title="{{ image['title'] }}">
<img src="{{ image['url_thumb'] }}" alt="{{ image['title'] }}" /></a>
<img src="{{ image['url_thumb'] }}" alt="{{ image['title']|e }}" /></a>
{% endfor %}
</ul>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/index.tmpl
Expand Up @@ -22,10 +22,10 @@
{% if author_pages_generated %}
<a href="{{ _link('author', post.author()) }}">{{ post.author() }}</a>
{% else %}
{{ post.author() }}
{{ post.author()|e }}
{% endif %}
</span></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></a></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></a></p>
{% if not post.meta('nocomments') and site_has_comments %}
<p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }}
{% endif %}
Expand Down
18 changes: 12 additions & 6 deletions nikola/data/themes/base-jinja/templates/index_helper.tmpl
Expand Up @@ -20,11 +20,17 @@

{% macro mathjax_script(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% if use_katex %}
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(document.body);
</script>
{% else %}
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endmacro %}
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/list.tmpl
Expand Up @@ -4,12 +4,12 @@
{% block content %}
<article class="listpage">
<header>
<h1>{{ title }}</h1>
<h1>{{ title|e }}</h1>
</header>
{% if items %}
<ul class="postlist">
{% for text, link, count in items %}
<li><a href="{{ link }}">{{ text }}</a>
<li><a href="{{ link }}">{{ text|e }}</a>
{% if count %}
({{ count }})
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/list_post.tmpl
Expand Up @@ -4,12 +4,12 @@
{% block content %}
<article class="listpage">
<header>
<h1>{{ title }}</h1>
<h1>{{ title|e }}</h1>
</header>
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></li>
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
{% endfor %}
</ul>
{% else %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/listing.tmpl
Expand Up @@ -6,10 +6,10 @@
{% if folders or files %}
<ul>
{% for name in folders %}
<li><a href="{{ name }}"><i class="icon-folder-open"></i> {{ name }}</a>
<li><a href="{{ name|urlencode }}"><i class="icon-folder-open"></i> {{ name|e }}</a>
{% endfor %}
{% for name in files %}
<li><a href="{{ name }}.html"><i class="icon-file"></i> {{ name }}</a>
<li><a href="{{ name|urlencode }}.html"><i class="icon-file"></i> {{ name|e }}</a>
{% endfor %}
</ul>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/post.tmpl
Expand Up @@ -10,9 +10,9 @@
<meta name="keywords" content="{{ post.meta('keywords')|e }}">
{% endif %}
{% if post.description() %}
<meta name="description" content="{{ post.description() }}">
<meta name="description" content="{{ post.description()|e }}">
{% endif %}
<meta name="author" content="{{ post.author() }}">
<meta name="author" content="{{ post.author()|e }}">
{% if post.prev_post %}
<link rel="prev" href="{{ post.prev_post.permalink() }}" title="{{ post.prev_post.title()|e }}" type="text/html">
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions nikola/data/themes/base-jinja/templates/post_header.tmpl
Expand Up @@ -33,12 +33,12 @@
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">
{% if author_pages_generated %}
<a href="{{ _link('author', post.author()) }}">{{ post.author() }}</a>
<a href="{{ _link('author', post.author()) }}">{{ post.author()|e }}</a>
{% else %}
{{ post.author() }}
{{ post.author()|e }}
{% endif %}
</span></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time></a></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></a></p>
{% if not post.meta('nocomments') and site_has_comments %}
<p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }}
{% endif %}
Expand All @@ -47,7 +47,7 @@
<p class="linkline"><a href="{{ post.meta('link') }}">{{ messages("Original site") }}</a></p>
{% endif %}
{% if post.description() %}
<meta name="description" itemprop="description" content="{{ post.description() }}">
<meta name="description" itemprop="description" content="{{ post.description()|e }}">
{% endif %}
</div>
{{ html_translations(post) }}
Expand Down
24 changes: 15 additions & 9 deletions nikola/data/themes/base-jinja/templates/post_helper.tmpl
Expand Up @@ -15,7 +15,7 @@
<ul itemprop="keywords" class="tags">
{% for tag in post.tags %}
{% if tag not in hidden_tags %}
<li><a class="tag p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag }}</a></li>
<li><a class="tag p-category" href="{{ _link('tag', tag) }}" rel="tag">{{ tag|e }}</a></li>
{% endif %}
{% endfor %}
</ul>
Expand Down Expand Up @@ -55,14 +55,14 @@
<meta property="og:type" content="article">
{# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #}
{# %if post.author(): #}
{# <meta property="article:author" content="{{ post.author() }}"> #}
{# <meta property="article:author" content="{{ post.author()|e }}"> #}
{# %endif #}
{% if post.date.isoformat() %}
<meta property="article:published_time" content="{{ post.formatted_date('webiso') }}">
{% endif %}
{% if post.tags %}
{% for tag in post.tags %}
<meta property="article:tag" content="{{ tag }}">
<meta property="article:tag" content="{{ tag|e }}">
{% endfor %}
{% endif %}
{% endif %}
Expand All @@ -86,11 +86,17 @@

{% macro mathjax_script(post) %}
{% if post.is_mathjax %}
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% if use_katex %}
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(document.body);
</script>
{% else %}
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endmacro %}
Expand Up @@ -6,7 +6,7 @@
<ul class="post-list">
{% for post in posts %}
<li class="post-list-item">
{{ post.formatted_date(date_format) }}
{{ post.formatted_date(date_format)|e }}
&nbsp;
<a href="{{ post.permalink(lang) }}">{{ post.title(lang)|e }}</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/sectionindex.tmpl
Expand Up @@ -4,14 +4,14 @@
{% block extra_head %}
{{ super() }}
{% if generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ posts[0].section_name() }} section" href="{{ _link('section_index_atom', posts[0].section_slug()) }}">
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ posts[0].section_name()|e }} section" href="{{ _link('section_index_atom', posts[0].section_slug()) }}">
{% endif %}
{% endblock %}

{% block content %}
<div class="sectionindex">
<header>
<h2><a href="{{ posts[0].section_link() }}">{{ title }}</a></h2>
<h2><a href="{{ posts[0].section_link() }}">{{ title|e }}</a></h2>
{% if generate_atom %}
<p class="feedlink"><a href="{{ _link('section_index_atom', posts[0].section_slug()) }}" type="application/atom+xml">{{ messages('Updates') }}</a></p>
{% endif %}
Expand Down
10 changes: 5 additions & 5 deletions nikola/data/themes/base-jinja/templates/tag.tmpl
Expand Up @@ -5,10 +5,10 @@
{{ super() }}
{% if translations|length > 1 and generate_rss %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ tag }} ({{ language }})" href="{{ _link(kind + "_rss", tag, language) }}">
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ tag|e }} ({{ language }})" href="{{ _link(kind + "_rss", tag, language) }}">
{% endfor %}
{% elif generate_rss %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ tag }}" href="{{ _link(kind + "_rss", tag) }}">
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ tag|e }}" href="{{ _link(kind + "_rss", tag) }}">
{% endif %}
{% endblock %}

Expand All @@ -18,13 +18,13 @@
<header>
<h1>{{ title|e }}</h1>
{% if description %}
<p>{{ description }}</p>
<p>{{ description|e }}</p>
{% endif %}
{% if subcategories %}
{{ messages('Subcategories:') }}
<ul>
{% for name, link in subcategories %}
<li><a href="{{ link }}">{{ name }}</a></li>
<li><a href="{{ link }}">{{ name|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
Expand All @@ -43,7 +43,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format) }}">{{ post.formatted_date(date_format) }}</time><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions nikola/data/themes/base-jinja/templates/tagindex.tmpl
Expand Up @@ -6,7 +6,7 @@
{{ messages('Subcategories:') }}
<ul>
{% for name, link in subcategories %}
<li><a href="{{ link }}">{{ name }}</a></li>
<li><a href="{{ link }}">{{ name|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
Expand All @@ -16,9 +16,9 @@
{{ super() }}
{% if translations|length > 1 and generate_atom %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag }} section ({{ language }})" href="{{ _link(kind + "_atom", tag, language) }}">
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag|e }} section ({{ language }})" href="{{ _link(kind + "_atom", tag, language) }}">
{% endfor %}
{% elif generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag }} section" href="{{ _link("tag" + "_atom", tag) }}">
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ tag|e }} section" href="{{ _link("tag" + "_atom", tag) }}">
{% endif %}
{% endblock %}
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/tags.tmpl
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<article class="tagindex">
<header>
<h1>{{ title }}</h1>
<h1>{{ title|e }}</h1>
</header>
{% if cat_items %}
{% if items %}
Expand Down Expand Up @@ -33,7 +33,7 @@
<ul class="postlist">
{% for text, link in items %}
{% if text not in hidden_tags %}
<li><a class="reference listtitle" href="{{ link }}">{{ text }}</a></li>
<li><a class="reference listtitle" href="{{ link }}">{{ text|e }}</a></li>
{% endif %}
{% endfor %}
</ul>
Expand Down

0 comments on commit 7122250

Please sign in to comment.