Skip to content
Permalink
Browse files

Merge branch 'master' into fix-1883

  • Loading branch information
Kwpolska committed Jul 11, 2015
2 parents 45c80d4 + c84ae58 commit 81817e1130dc26d8d0a2000811c07db8ab38f528
@@ -5,6 +5,7 @@ Features
--------

* Add ``--no-server`` option to ``nikola auto`` (Issue #1883)
* Always return unicode in slugify (Issue #1885)
* Remove logging handlers (Issue #1797)
* Add ``-d``, ``--detach`` option to ``nikola serve`` (Issue #1871)
* Use provided teaser format (``*_READ_MORE_LINK``) with custom teaser text
@@ -4,7 +4,7 @@
{% block extra_head %}
{{ super() }}
{% if translations|length > 1 and generate_atom %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} section ({{ language }})" href="{{ _link("archive_atom", archive_name, language) }}">
{% endfor %}
{% elif generate_atom %}
@@ -90,7 +90,7 @@ lang="{{ lang }}">
{{ rss_link }}
{% elif generate_rss %}
{% if translations|length > 1 %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}">
{% endfor %}
{% else %}
@@ -99,7 +99,7 @@ lang="{{ lang }}">
{% endif %}
{% if generate_atom %}
{% if translations|length > 1 %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}">
{% endfor %}
{% else %}
@@ -110,7 +110,7 @@ lang="{{ lang }}">

{% macro html_translations() %}
<ul class="translations">
{% for langname in translations.keys() %}
{% 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 %}
@@ -12,7 +12,7 @@
{% if post.translated_to|length > 1 %}
<div class="metadata posttranslations translations">
<h3 class="posttranslations-intro">{{ messages("Also available in:") }}</h3>
{% for langname in translations.keys() %}
{% for langname in translations|sort %}
{% if langname != lang and post.is_translation_available(langname) %}
<p><a href="{{ post.permalink(langname) }}" rel="alternate" hreflang="{{ langname }}">{{ messages("LANGUAGE", langname) }}</a></p>
{% endif %}
@@ -2,7 +2,7 @@

{% macro meta_translations(post) %}
{% if translations|length > 1 %}
{% for langname in translations.keys() %}
{% for langname in translations|sort %}
{% if langname != lang and post.is_translation_available(langname) %}
<link rel="alternate" hreflang="{{ langname }}" href="{{ post.permalink(langname) }}">
{% endif %}
@@ -4,7 +4,7 @@
{% block extra_head %}
{{ super() }}
{% if translations|length > 1 and generate_rss %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" type="application/rss+xml" title="RSS for {{ kind }} {{ tag }} ({{ language }})" href="{{ _link(kind + "_rss", tag, language) }}">
{% endfor %}
{% elif generate_rss %}
@@ -30,7 +30,7 @@
{% endif %}
<div class="metadata">
{% if translations|length > 1 and generate_rss %}
{% for language in translations %}
{% for language in translations|sort %}
<p class="feedlink">
<a href="{{ _link(kind + "_rss", tag, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a>&nbsp;
</p>
@@ -15,7 +15,7 @@
{% block extra_head %}
{{ super() }}
{% if translations|length > 1 and generate_atom %}
{% for language in translations %}
{% 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) }}">
{% endfor %}
{% elif generate_atom %}
@@ -4,7 +4,7 @@
<%block name="extra_head">
${parent.extra_head()}
%if len(translations) > 1 and generate_atom:
%for language in translations:
%for language in sorted(translations):
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} section (${language})" href="${_link("archive_atom", archive_name, language)}">
%endfor
%elif generate_atom:
@@ -90,7 +90,7 @@ lang="${lang}">
${rss_link}
%elif generate_rss:
%if len(translations) > 1:
%for language in translations:
%for language in sorted(translations):
<link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
%endfor
%else:
@@ -99,7 +99,7 @@ lang="${lang}">
%endif
%if generate_atom:
%if len(translations) > 1:
%for language in translations:
%for language in sorted(translations):
<link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link('index_atom', None, language)}">
%endfor
%else:
@@ -110,7 +110,7 @@ lang="${lang}">

<%def name="html_translations()">
<ul class="translations">
%for langname in translations.keys():
%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
@@ -12,7 +12,7 @@
% if len(post.translated_to) > 1:
<div class="metadata posttranslations translations">
<h3 class="posttranslations-intro">${messages("Also available in:")}</h3>
% for langname in translations.keys():
% for langname in sorted(translations):
% if langname != lang and post.is_translation_available(langname):
<p><a href="${post.permalink(langname)}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></p>
% endif
@@ -2,7 +2,7 @@

<%def name="meta_translations(post)">
%if len(translations) > 1:
%for langname in translations.keys():
%for langname in sorted(translations):
%if langname != lang and post.is_translation_available(langname):
<link rel="alternate" hreflang="${langname}" href="${post.permalink(langname)}">
%endif
@@ -4,7 +4,7 @@
<%block name="extra_head">
${parent.extra_head()}
%if len(translations) > 1 and generate_rss:
%for language in translations:
%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)}">
%endfor
%elif generate_rss:
@@ -30,7 +30,7 @@
%endif
<div class="metadata">
%if len(translations) > 1 and generate_rss:
%for language in translations:
%for language in sorted(translations):
<p class="feedlink">
<a href="${_link(kind + "_rss", tag, language)}" hreflang="${language}" type="application/rss+xml">${messages('RSS feed', language)} (${language})</a>&nbsp;
</p>
@@ -15,7 +15,7 @@
<%block name="extra_head">
${parent.extra_head()}
%if len(translations) > 1 and generate_atom:
%for language in translations:
%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)}">
%endfor
%elif generate_atom:
@@ -154,7 +154,7 @@ lang="{{ lang }}">
{{ rss_link }}
{% elif generate_rss %}
{% if translations|length > 1 %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link('rss', None, language) }}">
{% endfor %}
{% else %}
@@ -163,7 +163,7 @@ lang="{{ lang }}">
{% endif %}
{% if generate_atom %}
{% if translations|length > 1 %}
{% for language in translations %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link('index_atom', None, language) }}">
{% endfor %}
{% else %}
@@ -173,7 +173,7 @@ lang="{{ lang }}">
{% endmacro %}

{% macro html_translations() %}
{% for langname in translations.keys() %}
{% 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 %}
@@ -154,7 +154,7 @@ lang="${lang}">
${rss_link}
%elif generate_rss:
%if len(translations) > 1:
%for language in translations:
%for language in sorted(translations):
<link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
%endfor
%else:
@@ -163,7 +163,7 @@ lang="${lang}">
%endif
%if generate_atom:
%if len(translations) > 1:
%for language in translations:
%for language in sorted(translations):
<link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link('index_atom', None, language)}">
%endfor
%else:
@@ -173,7 +173,7 @@ lang="${lang}">
</%def>

<%def name="html_translations()">
%for langname in translations.keys():
%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
@@ -1567,7 +1567,7 @@ def generic_page_renderer(self, lang, post, filters):

task = {
'name': os.path.normpath(output_name),
'file_dep': deps,
'file_dep': sorted(deps),
'targets': [output_name],
'actions': [(self.render_template, [post.template_name,
output_name, context])],
@@ -1581,7 +1581,8 @@ def generic_post_list_renderer(self, lang, posts, output_name,
template_name, filters, extra_context):
"""Renders pages with lists of posts."""

deps = self.template_system.template_deps(template_name)
deps = []
deps += self.template_system.template_deps(template_name)
uptodate_deps = []
for post in posts:
deps += post.deps(lang)
@@ -1610,7 +1611,7 @@ def generic_post_list_renderer(self, lang, posts, output_name,
task = {
'name': os.path.normpath(output_name),
'targets': [output_name],
'file_dep': deps,
'file_dep': sorted(deps),
'actions': [(self.render_template, [template_name, output_name,
context])],
'clean': True,
@@ -25,9 +25,9 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import unicode_literals
import io
import datetime
import glob
import io
import json
import mimetypes
import os
@@ -183,11 +183,13 @@ def gen_tasks(self):

crumbs = utils.get_crumbs(gallery, index_folder=self)

# Create index.html for each language
for lang in self.kw['translations']:
# save navigation links as dependencies
self.kw['navigation_links|{0}'.format(lang)] = self.kw['global_context']['navigation_links'](lang)

# Create index.html for each language
for lang in self.kw['translations']:

dst = os.path.join(
self.kw['output_folder'],
self.site.path("gallery", gallery, lang))
@@ -246,7 +248,7 @@ def gen_tasks(self):
'targets': [post.translated_base_path(lang)],
'file_dep': post.fragment_deps(lang),
'actions': [(post.compile, [lang])],
'uptodate': [utils.config_changed(self.kw, 'nikola.plugins.task.galleries:post')] + post.fragment_deps_uptodate(lang)
'uptodate': [utils.config_changed(self.kw.copy(), 'nikola.plugins.task.galleries:post')] + post.fragment_deps_uptodate(lang)
}
context['post'] = post
else:
@@ -268,14 +270,14 @@ def gen_tasks(self):
(self.render_gallery_index, (
template_name,
dst,
context,
context.copy(),
dest_img_list,
img_titles,
thumbs,
file_dep))],
'clean': True,
'uptodate': [utils.config_changed({
1: self.kw,
1: self.kw.copy(),
2: self.site.config["COMMENTS_IN_GALLERIES"],
3: context.copy(),
}, 'nikola.plugins.task.galleries:gallery')],
@@ -305,7 +307,7 @@ def gen_tasks(self):
))],
'clean': True,
'uptodate': [utils.config_changed({
1: self.kw,
1: self.kw.copy(),
}, 'nikola.plugins.task.galleries:rss')],
}, self.kw['filters'])

@@ -366,7 +368,7 @@ def create_galleries(self):
'actions': [(utils.makedirs, (output_gallery,))],
'targets': [output_gallery],
'clean': True,
'uptodate': [utils.config_changed(self.kw, 'nikola.plugins.task.galleries:mkdir')],
'uptodate': [utils.config_changed(self.kw.copy(), 'nikola.plugins.task.galleries:mkdir')],
}

def parse_index(self, gallery, input_folder, output_folder):
@@ -493,7 +495,7 @@ def remove_excluded_image(self, img, input_folder):
(utils.remove_file, (thumb_path,))
],
'clean': True,
'uptodate': [utils.config_changed(self.kw, 'nikola.plugins.task.galleries:clean_thumb')],
'uptodate': [utils.config_changed(self.kw.copy(), 'nikola.plugins.task.galleries:clean_thumb')],
}, self.kw['filters'])

yield utils.apply_filters({
@@ -503,7 +505,7 @@ def remove_excluded_image(self, img, input_folder):
(utils.remove_file, (img_path,))
],
'clean': True,
'uptodate': [utils.config_changed(self.kw, 'nikola.plugins.task.galleries:clean_file')],
'uptodate': [utils.config_changed(self.kw.copy(), 'nikola.plugins.task.galleries:clean_file')],
}, self.kw['filters'])

def render_gallery_index(
@@ -543,7 +545,7 @@ def url_from_path(p):
},
})
context['photo_array'] = photo_array
context['photo_array_json'] = json.dumps(photo_array)
context['photo_array_json'] = json.dumps(photo_array, sort_keys=True)
self.site.render_template(template_name, output_name, context)

def gallery_rss(self, img_list, dest_img_list, img_titles, lang, permalink, output_path, title):
@@ -438,7 +438,7 @@ def deps(self, lang):
deps.extend([cand_1, cand_2])
deps += self._get_dependencies(self._dependency_file_page[lang])
deps += self._get_dependencies(self._dependency_file_page[None])
return deps
return sorted(deps)

def deps_uptodate(self, lang):
"""Return a list of uptodate dependencies to build this post's page.
@@ -498,7 +498,7 @@ def fragment_deps(self, lang):
deps = [d for d in deps if os.path.exists(d)]
deps += self._get_dependencies(self._dependency_file_fragment[lang])
deps += self._get_dependencies(self._dependency_file_fragment[None])
return deps
return sorted(deps)

def fragment_deps_uptodate(self, lang):
"""Return a list of file dependencies to build this post's fragment."""

0 comments on commit 81817e1

Please sign in to comment.
You can’t perform that action at this time.