diff options
Diffstat (limited to 'nikola/data/themes/base/templates')
19 files changed, 172 insertions, 42 deletions
diff --git a/nikola/data/themes/base/templates/author.tmpl b/nikola/data/themes/base/templates/author.tmpl new file mode 100644 index 0000000..3ad5140 --- /dev/null +++ b/nikola/data/themes/base/templates/author.tmpl @@ -0,0 +1,43 @@ +## -*- coding: utf-8 -*- +<%inherit file="list_post.tmpl"/> + +<%block name="extra_head"> + ${parent.extra_head()} + %if len(translations) > 1 and generate_rss: + %for language in sorted(translations): + <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${author|h} (${language})" href="${_link(kind + "_rss", author, language)}"> + %endfor + %elif generate_rss: + <link rel="alternate" type="application/rss+xml" title="RSS for ${kind} ${author|h}" href="${_link(kind + "_rss", author)}"> + %endif +</%block> + + +<%block name="content"> +<article class="authorpage"> + <header> + <h1>${title|h}</h1> + %if description: + <p>${description}</p> + %endif + <div class="metadata"> + %if len(translations) > 1 and generate_rss: + %for language in sorted(translations): + <p class="feedlink"> + <a href="${_link(kind + "_rss", author, language)}" hreflang="${language}" type="application/rss+xml">${messages('RSS feed', language)} (${language})</a> + </p> + %endfor + %elif generate_rss: + <p class="feedlink"><a href="${_link(kind + "_rss", author)}" type="application/rss+xml">${messages('RSS feed')}</a></p> + %endif + </div> + </header> + %if posts: + <ul class="postlist"> + % for post in posts: + <li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li> + % endfor + </ul> + %endif +</article> +</%block> diff --git a/nikola/data/themes/base/templates/authorindex.tmpl b/nikola/data/themes/base/templates/authorindex.tmpl new file mode 100644 index 0000000..34cb20b --- /dev/null +++ b/nikola/data/themes/base/templates/authorindex.tmpl @@ -0,0 +1,13 @@ +## -*- coding: utf-8 -*- +<%inherit file="index.tmpl"/> + +<%block name="extra_head"> + ${parent.extra_head()} + %if len(tranlations) > 1 and generate_atom: + %for language in sorted(translations): + <link rel="alternate" type="application/atom+xml" title="Atom for the ${author|h} section (${language})" href="${_link(kind + "_atom", author, language)}"> + %endfor + %elif generate_atom: + <link rel="alternate" type="application/atom+xml" title="Atom for the ${author|h} section" href="${_link("author" + "_atom", author)}"> + %endif +</%block> diff --git a/nikola/data/themes/base/templates/authors.tmpl b/nikola/data/themes/base/templates/authors.tmpl new file mode 100644 index 0000000..141c560 --- /dev/null +++ b/nikola/data/themes/base/templates/authors.tmpl @@ -0,0 +1,17 @@ +## -*- coding: utf-8 -*- +<%inherit file="base.tmpl"/> + +<%block name="content"> +<article class="authorindex"> + %if items: + <h2>${messages("Authors")}</h2> + <ul class="postlist"> + % for text, link in items: + % if text not in hidden_authors: + <li><a class="reference listtitle" href="${link}">${text|h}</a></li> + % endif + % endfor + </ul> + %endif +</article> +</%block> diff --git a/nikola/data/themes/base/templates/base_header.tmpl b/nikola/data/themes/base/templates/base_header.tmpl index e29e2b3..2ffcfee 100644 --- a/nikola/data/themes/base/templates/base_header.tmpl +++ b/nikola/data/themes/base/templates/base_header.tmpl @@ -16,13 +16,13 @@ </%def> <%def name="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|h}" rel="home"> %if logo_url: - <img src="${logo_url}" alt="${blog_title}" id="logo"> + <img src="${logo_url}" alt="${blog_title|h}" id="logo"> %endif % if show_blog_title: - <span id="blog-title">${blog_title}</span> + <span id="blog-title">${blog_title|h}</span> % endif </a></h1> </%def> diff --git a/nikola/data/themes/base/templates/base_helper.tmpl b/nikola/data/themes/base/templates/base_helper.tmpl index 948cfba..35ed983 100644 --- a/nikola/data/themes/base/templates/base_helper.tmpl +++ b/nikola/data/themes/base/templates/base_helper.tmpl @@ -21,9 +21,11 @@ dir="rtl" \ lang="${lang}"> <head> <meta charset="utf-8"> + % if use_base_tag: <base href="${abs_link(permalink)}"> + % endif %if description: - <meta name="description" content="${description}"> + <meta name="description" content="${description|h}"> %endif <meta name="viewport" content="width=device-width"> %if title == blog_title: @@ -33,6 +35,7 @@ lang="${lang}"> %endif ${html_stylesheets()} + <meta content="${theme_color}" name="theme-color"> ${html_feedlinks()} <link rel="canonical" href="${abs_link(permalink)}"> diff --git a/nikola/data/themes/base/templates/gallery.tmpl b/nikola/data/themes/base/templates/gallery.tmpl index 0ee07ac..126d51c 100644 --- a/nikola/data/themes/base/templates/gallery.tmpl +++ b/nikola/data/themes/base/templates/gallery.tmpl @@ -17,8 +17,8 @@ %if folders: <ul> % for folder, ftitle in folders: - <li><a href="${folder}"><i - class="icon-folder-open"></i> ${ftitle}</a></li> + <li><a href="${folder|u}"><i + class="icon-folder-open"></i> ${ftitle|h}</a></li> % endfor </ul> %endif @@ -26,7 +26,7 @@ <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']|h}" /></a> %endfor </ul> %endif diff --git a/nikola/data/themes/base/templates/index.tmpl b/nikola/data/themes/base/templates/index.tmpl index 88bb25c..294bdaf 100644 --- a/nikola/data/themes/base/templates/index.tmpl +++ b/nikola/data/themes/base/templates/index.tmpl @@ -18,8 +18,14 @@ <header> <h1 class="p-name entry-title"><a href="${post.permalink()}" class="u-url">${post.title()|h}</a></h1> <div class="metadata"> - <p class="byline author vcard"><span class="byline-name fn">${post.author()}</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="byline author vcard"><span class="byline-name fn"> + % if author_pages_generated: + <a href="${_link('author', post.author())}">${post.author()|h}</a> + % else: + ${post.author()|h} + % 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)|h}">${post.formatted_date(date_format)|h}</time></a></p> % if not post.meta('nocomments') and site_has_comments: <p class="commentline">${comments.comment_link(post.permalink(), post._base_path)} % endif diff --git a/nikola/data/themes/base/templates/index_helper.tmpl b/nikola/data/themes/base/templates/index_helper.tmpl index 9331b93..fae046d 100644 --- a/nikola/data/themes/base/templates/index_helper.tmpl +++ b/nikola/data/themes/base/templates/index_helper.tmpl @@ -20,8 +20,17 @@ <%def name="mathjax_script(posts)"> %if any(post.is_mathjax for post in posts): - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script> - <script src="/assets/js/mathjax.js"></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 </%def> diff --git a/nikola/data/themes/base/templates/list.tmpl b/nikola/data/themes/base/templates/list.tmpl index 4082516..5a8843d 100644 --- a/nikola/data/themes/base/templates/list.tmpl +++ b/nikola/data/themes/base/templates/list.tmpl @@ -4,12 +4,15 @@ <%block name="content"> <article class="listpage"> <header> - <h1>${title}</h1> + <h1>${title|h}</h1> </header> %if items: <ul class="postlist"> - % for text, link in items: - <li><a href="${link}">${text}</a> + % for text, link, count in items: + <li><a href="${link}">${text|h}</a> + % if count: + (${count}) + % endif % endfor </ul> %else: diff --git a/nikola/data/themes/base/templates/list_post.tmpl b/nikola/data/themes/base/templates/list_post.tmpl index 3335fa6..5fd4df1 100644 --- a/nikola/data/themes/base/templates/list_post.tmpl +++ b/nikola/data/themes/base/templates/list_post.tmpl @@ -4,12 +4,12 @@ <%block name="content"> <article class="listpage"> <header> - <h1>${title}</h1> + <h1>${title|h}</h1> </header> %if posts: <ul class="postlist"> % for post in posts: - <li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</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()|h}</a> <time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li> % endfor </ul> %else: diff --git a/nikola/data/themes/base/templates/listing.tmpl b/nikola/data/themes/base/templates/listing.tmpl index e0bf91b..1800bd9 100644 --- a/nikola/data/themes/base/templates/listing.tmpl +++ b/nikola/data/themes/base/templates/listing.tmpl @@ -6,10 +6,10 @@ ${ui.bar(crumbs)} %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|u}"><i class="icon-folder-open"></i> ${name|h}</a> % endfor % for name in files: - <li><a href="${name}.html"><i class="icon-file"></i> ${name}</a> + <li><a href="${name|u}.html"><i class="icon-file"></i> ${name|h}</a> % endfor </ul> %endif diff --git a/nikola/data/themes/base/templates/post.tmpl b/nikola/data/themes/base/templates/post.tmpl index cbb81ef..da616bf 100644 --- a/nikola/data/themes/base/templates/post.tmpl +++ b/nikola/data/themes/base/templates/post.tmpl @@ -10,9 +10,9 @@ <meta name="keywords" content="${post.meta('keywords')|h}"> % endif %if post.description(): - <meta name="description" content="${post.description()}"> + <meta name="description" content="${post.description()|h}"> %endif - <meta name="author" content="${post.author()}"> + <meta name="author" content="${post.author()|h}"> %if post.prev_post: <link rel="prev" href="${post.prev_post.permalink()}" title="${post.prev_post.title()|h}" type="text/html"> %endif diff --git a/nikola/data/themes/base/templates/post_header.tmpl b/nikola/data/themes/base/templates/post_header.tmpl index 75383cb..480c36a 100644 --- a/nikola/data/themes/base/templates/post_header.tmpl +++ b/nikola/data/themes/base/templates/post_header.tmpl @@ -31,17 +31,23 @@ <header> ${html_title()} <div class="metadata"> - <p class="byline author vcard"><span class="byline-name fn">${post.author()}</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="byline author vcard"><span class="byline-name fn"> + % if author_pages_generated: + <a href="${_link('author', post.author())}">${post.author()|h}</a> + % else: + ${post.author()|h} + % 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)|h}">${post.formatted_date(date_format)|h}</time></a></p> % if not post.meta('nocomments') and site_has_comments: <p class="commentline">${comments.comment_link(post.permalink(), post._base_path)} % endif ${html_sourcelink()} % if post.meta('link'): - <p class="linkline"><a href='${post.meta('link')}'>${messages("Original site")}</a></p> + <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()|h}"> %endif </div> ${html_translations(post)} diff --git a/nikola/data/themes/base/templates/post_helper.tmpl b/nikola/data/themes/base/templates/post_helper.tmpl index 424d134..f8572ec 100644 --- a/nikola/data/themes/base/templates/post_helper.tmpl +++ b/nikola/data/themes/base/templates/post_helper.tmpl @@ -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|h}</a></li> % endif %endfor </ul> @@ -41,7 +41,7 @@ <%def name="open_graph_metadata(post)"> %if use_open_graph: - <meta property="og:site_name" content="${blog_title|striphtml}"> + <meta property="og:site_name" content="${blog_title|h}"> <meta property="og:title" content="${post.title()[:70]|h}"> <meta property="og:url" content="${abs_link(permalink)}"> %if post.description(): @@ -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()|h}"> ### %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|h}"> %endfor %endif %endif @@ -86,8 +86,17 @@ <%def name="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> + %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 </%def> diff --git a/nikola/data/themes/base/templates/post_list_directive.tmpl b/nikola/data/themes/base/templates/post_list_directive.tmpl index e080a81..4a136a1 100644 --- a/nikola/data/themes/base/templates/post_list_directive.tmpl +++ b/nikola/data/themes/base/templates/post_list_directive.tmpl @@ -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)|h} <a href="${post.permalink(lang)}">${post.title(lang)|h}</a> </li> diff --git a/nikola/data/themes/base/templates/sectionindex.tmpl b/nikola/data/themes/base/templates/sectionindex.tmpl new file mode 100644 index 0000000..7fb4f1e --- /dev/null +++ b/nikola/data/themes/base/templates/sectionindex.tmpl @@ -0,0 +1,21 @@ +## -*- coding: utf-8 -*- +<%inherit file="index.tmpl"/> + +<%block name="extra_head"> + ${parent.extra_head()} + % if generate_atom: + <link rel="alternate" type="application/atom+xml" title="Atom for the ${posts[0].section_name()|h} section" href="${_link('section_index_atom', posts[0].section_slug())}"> + % endif +</%block> + +<%block name="content"> +<div class="sectionindex"> + <header> + <h2><a href="${_link('section_index', posts[0].section_slug())}">${title|h}</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 + </header> + ${parent.content()} +</div> +</%block> diff --git a/nikola/data/themes/base/templates/tag.tmpl b/nikola/data/themes/base/templates/tag.tmpl index 7509f3e..d07c434 100644 --- a/nikola/data/themes/base/templates/tag.tmpl +++ b/nikola/data/themes/base/templates/tag.tmpl @@ -5,10 +5,10 @@ ${parent.extra_head()} %if len(translations) > 1 and generate_rss: %for language in sorted(translations): - <link rel="alternate" type="application/rss+xml" 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|h} (${language})" href="${_link(kind + "_rss", tag, language)}"> %endfor %elif generate_rss: - <link rel="alternate" type="application/rss+xml" 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|h}" href="${_link(kind + "_rss", tag)}"> %endif </%block> @@ -24,7 +24,7 @@ ${messages('Subcategories:')} <ul> %for name, link in subcategories: - <li><a href="${link}">${name}</a></li> + <li><a href="${link}">${name|h}</a></li> %endfor </ul> %endif @@ -43,7 +43,7 @@ %if posts: <ul class="postlist"> % for post in posts: - <li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a> <time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)}">${post.formatted_date(date_format)}</time></li> + <li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time><a href="${post.permalink()}" class="listtitle">${post.title()|h}<a></li> % endfor </ul> %endif diff --git a/nikola/data/themes/base/templates/tagindex.tmpl b/nikola/data/themes/base/templates/tagindex.tmpl index 0834411..047d638 100644 --- a/nikola/data/themes/base/templates/tagindex.tmpl +++ b/nikola/data/themes/base/templates/tagindex.tmpl @@ -6,7 +6,7 @@ ${messages('Subcategories:')} <ul> %for name, link in subcategories: - <li><a href="${link}">${name}</a></li> + <li><a href="${link}">${name|h}</a></li> %endfor </ul> %endif @@ -16,9 +16,9 @@ ${parent.extra_head()} %if len(translations) > 1 and generate_atom: %for language in sorted(translations): - <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|h} 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|h} section" href="${_link("tag" + "_atom", tag)}"> %endif </%block> diff --git a/nikola/data/themes/base/templates/tags.tmpl b/nikola/data/themes/base/templates/tags.tmpl index a9d2dd7..6c329d9 100644 --- a/nikola/data/themes/base/templates/tags.tmpl +++ b/nikola/data/themes/base/templates/tags.tmpl @@ -4,7 +4,7 @@ <%block name="content"> <article class="tagindex"> <header> - <h1>${title}</h1> + <h1>${title|h}</h1> </header> % if cat_items: % if items: @@ -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|h}</a></li> % endif % endfor </ul> |
