Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reverted
  • Loading branch information
ralsina committed Sep 10, 2015
1 parent bfff304 commit bc3bb14
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 88 deletions.
1 change: 0 additions & 1 deletion nikola/data/themes/base-jinja/templates/listing.tmpl
@@ -1,7 +1,6 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% import 'crumbs.tmpl' as ui with context %}

{% block content %}
{{ ui.bar(crumbs) }}
{% if folders or files %}
Expand Down
1 change: 0 additions & 1 deletion nikola/data/themes/base/templates/listing.tmpl
@@ -1,7 +1,6 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%namespace name="ui" file="crumbs.tmpl" import="bar"/>

<%block name="content">
${ui.bar(crumbs)}
%if folders or files:
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/bootstrap3-jinja/templates/authors.tmpl
Expand Up @@ -2,9 +2,10 @@
{% extends 'base.tmpl' %}

{% block content %}
<article class="authorindex">
{% if items %}
<h2>{{ messages("Authors") }}</h2>
{% endif %}
{% if items %}
<ul class="list-inline">
{% for text, link in items %}
{% if text not in hidden_authors %}
Expand All @@ -13,5 +14,4 @@
{% endfor %}
</ul>
{% endif %}
</article>
{% endblock %}
115 changes: 100 additions & 15 deletions nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl
@@ -1,9 +1,74 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base-jinja/templates/base_helper.tmpl' %}
{% import 'annotation_helper.tmpl' as notes with context %}

{% import 'annotation_helper.tmpl' as notes with context %}
{% macro html_headstart() %}
{{ parent.html_headstart() }}
<!DOCTYPE html>
<html

{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %}
prefix='
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %}
og: http://ogp.me/ns#
{% endif %}
{% if use_open_graph %}
article: http://ogp.me/ns/article#
{% endif %}
{% if comment_system == 'facebook' %}
fb: http://ogp.me/ns/fb#
{% endif %}
'
{% endif %}

{% if is_rtl %}
dir="rtl"
{% endif %}

lang="{{ lang }}">
<head>
<meta charset="utf-8">
{% if use_base_tag %}
<base href="{{ abs_link(permalink) }}">
{% endif %}
{% if description %}
<meta name="description" content="{{ description }}">
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if title == blog_title %}
<title>{{ blog_title|e }}</title>
{% else %}
<title>{{ title|e }} | {{ blog_title|e }}</title>
{% endif %}

{{ html_stylesheets() }}
<meta content="{{ theme_color }}" name="theme-color">
{{ html_feedlinks() }}
<link rel="canonical" href="{{ abs_link(permalink) }}">

{% if favicons %}
{% for name, file, size in favicons %}
<link rel="{{ name }}" href="{{ file }}" sizes="{{ size }}"/>
{% endfor %}
{% endif %}

{% if comment_system == 'facebook' %}
<meta property="fb:app_id" content="{{ comment_system_id }}">
{% endif %}

{% if prevlink %}
<link rel="prev" href="{{ prevlink }}" type="text/html">
{% endif %}
{% if nextlink %}
<link rel="next" href="{{ nextlink }}" type="text/html">
{% endif %}

{{ mathjax_config }}
{% if use_cdn %}
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
{% else %}
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
{% endif %}

{{ extra_head_data }}
{% endmacro %}

{% macro late_load_js() %}
Expand Down Expand Up @@ -33,6 +98,7 @@
{{ social_buttons_code }}
{% endmacro %}


{% macro html_stylesheets() %}
{% if use_bundles %}
{% if use_cdn %}
Expand Down Expand Up @@ -66,18 +132,6 @@
{% endif %}
{% endmacro %}

{% macro html_feedlinks() %}
{{ parent.html_feedlinks() }}
{% endmacro %}

{% macro html_translations() %}
{% for langname in translations|sort %}
{% if langname != lang %}
<li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li>
{% endif %}
{% endfor %}
{% endmacro %}

{% macro html_navigation_links() %}
{% for url, text in navigation_links[lang] %}
{% if isinstance(url, tuple) %}
Expand All @@ -100,3 +154,34 @@
{% endif %}
{% endfor %}
{% endmacro %}

{% macro html_feedlinks() %}
{% if rss_link %}
{{ rss_link }}
{% elif generate_rss %}
{% if translations|length > 1 %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}">
{% endfor %}
{% else %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link('rss', None) }}">
{% endif %}
{% endif %}
{% if generate_atom %}
{% if translations|length > 1 %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}">
{% endfor %}
{% else %}
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link('index_atom', None) }}">
{% endif %}
{% endif %}
{% endmacro %}

{% macro html_translations() %}
{% for langname in translations|sort %}
{% if langname != lang %}
<li><a href="{{ abs_link(_link("root", None, langname)) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></li>
{% endif %}
{% endfor %}
{% endmacro %}
4 changes: 2 additions & 2 deletions nikola/data/themes/bootstrap3/templates/authors.tmpl
Expand Up @@ -2,9 +2,10 @@
<%inherit file="base.tmpl"/>

<%block name="content">
<article class="authorindex">
% if items:
<h2>${messages("Authors")}</h2>
% endif
% if items:
<ul class="list-inline">
% for text, link in items:
% if text not in hidden_authors:
Expand All @@ -13,5 +14,4 @@
% endfor
</ul>
% endif
</article>
</%block>
115 changes: 100 additions & 15 deletions nikola/data/themes/bootstrap3/templates/base_helper.tmpl
@@ -1,9 +1,74 @@
## -*- coding: utf-8 -*-
<%inherit file="base/templates/base_helper.tmpl"/>
<%namespace name="notes" file="annotation_helper.tmpl" import="*" />

<%namespace name="notes" file="annotation_helper.tmpl" import="*" />
<%def name="html_headstart()">
${parent.html_headstart()}
<!DOCTYPE html>
<html
\
% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook'):
prefix='\
%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']):
og: http://ogp.me/ns# \
%endif
%if use_open_graph:
article: http://ogp.me/ns/article# \
%endif
%if comment_system == 'facebook':
fb: http://ogp.me/ns/fb# \
%endif
'\
%endif
\
% if is_rtl:
dir="rtl" \
% endif
\
lang="${lang}">
<head>
<meta charset="utf-8">
% if use_base_tag:
<base href="${abs_link(permalink)}">
% endif
%if description:
<meta name="description" content="${description}">
%endif
<meta name="viewport" content="width=device-width, initial-scale=1">
%if title == blog_title:
<title>${blog_title|h}</title>
%else:
<title>${title|h} | ${blog_title|h}</title>
%endif

${html_stylesheets()}
<meta content="${theme_color}" name="theme-color">
${html_feedlinks()}
<link rel="canonical" href="${abs_link(permalink)}">

%if favicons:
%for name, file, size in favicons:
<link rel="${name}" href="${file}" sizes="${size}"/>
%endfor
%endif

% if comment_system == 'facebook':
<meta property="fb:app_id" content="${comment_system_id}">
% endif

%if prevlink:
<link rel="prev" href="${prevlink}" type="text/html">
%endif
%if nextlink:
<link rel="next" href="${nextlink}" type="text/html">
%endif

${mathjax_config}
%if use_cdn:
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
%else:
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
%endif

${extra_head_data}
</%def>

<%def name="late_load_js()">
Expand Down Expand Up @@ -33,6 +98,7 @@
${social_buttons_code}
</%def>


<%def name="html_stylesheets()">
%if use_bundles:
%if use_cdn:
Expand Down Expand Up @@ -66,18 +132,6 @@
% endif
</%def>

<%def name="html_feedlinks()">
${parent.html_feedlinks()}
</%def>

<%def name="html_translations()">
%for langname in sorted(translations):
%if langname != lang:
<li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li>
%endif
%endfor
</%def>

<%def name="html_navigation_links()">
%for url, text in navigation_links[lang]:
% if isinstance(url, tuple):
Expand All @@ -100,3 +154,34 @@
% endif
%endfor
</%def>

<%def name="html_feedlinks()">
%if rss_link:
${rss_link}
%elif generate_rss:
%if len(translations) > 1:
%for language in sorted(translations):
<link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
%endfor
%else:
<link rel="alternate" type="application/rss+xml" title="RSS" href="${_link('rss', None)}">
%endif
%endif
%if generate_atom:
%if len(translations) > 1:
%for language in sorted(translations):
<link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link('index_atom', None, language)}">
%endfor
%else:
<link rel="alternate" type="application/atom+xml" title="Atom" href="${_link('index_atom', None)}">
%endif
%endif
</%def>

<%def name="html_translations()">
%for langname in sorted(translations):
%if langname != lang:
<li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li>
%endif
%endfor
</%def>
6 changes: 2 additions & 4 deletions nikola/nikola.py
Expand Up @@ -1022,10 +1022,8 @@ def _get_template_system(self):
"plugin\n".format(template_sys_name))
sys.exit(1)
self._template_system = pi.plugin_object
lookup_dirs = ['templates'] + \
[os.path.join(utils.get_theme_path(name), "templates") for name in self.THEMES] +\
list(set([os.path.dirname(utils.get_theme_path(name)) for name in self.THEMES]))

lookup_dirs = ['templates'] + [os.path.join(utils.get_theme_path(name), "templates")
for name in self.THEMES]
self._template_system.set_directories(lookup_dirs,
self.config['CACHE_FOLDER'])
self._template_system.set_site(self)
Expand Down

0 comments on commit bc3bb14

Please sign in to comment.