Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into archive-navigation
  • Loading branch information
Kwpolska committed Dec 25, 2016
2 parents e83d413 + 7670c14 commit 372932b
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Bugfixes
--------

* Make ``AUTHOR_PAGES_ARE_INDEXES`` really work (Issue #2600)
* WordPress importer now correctly handles & etc. in tags.
(Issue #2557)
* If ``CODE_COLOR_SCHEME`` is empty, don’t generate ``code.css``
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/authorindex.tmpl
Expand Up @@ -3,7 +3,7 @@

{% block extra_head %}
{{ super() }}
{% if tranlations|length > 1 and generate_atom %}
{% if translations|length > 1 and generate_atom %}
{% for language in translations|sort %}
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author|e }} section ({{ language }})" href="{{ _link(kind + "_atom", author, language) }}">
{% endfor %}
Expand Down
2 changes: 2 additions & 0 deletions nikola/data/themes/base/messages/messages_en.py
Expand Up @@ -44,4 +44,6 @@
"Write your post here.": "Write your post here.",
"old posts, page %d": "old posts, page %d",
"page %d": "page %d",
"{month} {day}, {year}": "{month} {day}, {year}",
"{month} {year}": "{month} {year}",
}
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/authorindex.tmpl
Expand Up @@ -3,7 +3,7 @@

<%block name="extra_head">
${parent.extra_head()}
%if len(tranlations) > 1 and generate_atom:
%if len(translations) > 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
Expand Down
8 changes: 8 additions & 0 deletions nikola/nikola.py
Expand Up @@ -2168,6 +2168,14 @@ def generic_page_renderer(self, lang, post, filters, context=None):
if post:
deps_dict['post_translations'] = post.translated_to

signal('render_post').send({
'site': self,
'post': post,
'lang': lang,
'context': context,
'deps_dict': deps_dict,
})

yield self.generic_renderer(lang, output_name, post.template_name, filters,
file_deps=deps,
uptodate_deps=uptodate_deps,
Expand Down
5 changes: 3 additions & 2 deletions nikola/plugins/misc/taxonomies_classifier.py
Expand Up @@ -40,9 +40,9 @@


class TaxonomiesClassifier(SignalHandler):
"""Render the tag/category pages and feeds."""
"""Classify posts and pages by taxonomies."""

name = "render_taxonomies"
name = "classify_taxonomies"

def _do_classification(self, site):
# Needed to avoid strange errors during tests
Expand Down Expand Up @@ -192,6 +192,7 @@ def create_hierarchy(hierarchy, parent=None, level=0):
taxonomy_outputs[lang][path] = (taxonomy.classification_name, classification, list(posts))
if quit:
sys.exit(1)
blinker.signal('taxonomies_classified').send(site)

def _get_filtered_list(self, taxonomy, classification, lang):
"""Return the filtered list of posts for this classification and language."""
Expand Down
16 changes: 13 additions & 3 deletions nikola/plugins/task/archive.py
Expand Up @@ -99,10 +99,20 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
elif len(classification) == 1:
return classification[0]
elif len(classification) == 2:
return nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
if only_last_component:
return month
else:
year = classification[0]
return self.site.MESSAGES[lang]['{month} {year}'].format(year=year, month=month)
else:
# Fallback
return '/'.join(classification)
day = int(classification[2])
if only_last_component:
return str(day)
else:
year = classification[0]
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
return self.site.MESSAGES[lang]['{month} {day}, {year}'].format(year=year, month=month, day=day)

def get_path(self, classification, lang, dest_type='page'):
"""A path handler for the given classification."""
Expand Down
18 changes: 18 additions & 0 deletions nikola/plugins/task/taxonomies.py
Expand Up @@ -27,6 +27,7 @@
"""Render the taxonomy overviews, classification pages and feeds."""

from __future__ import unicode_literals
import blinker
import os
import natsort
from copy import copy
Expand Down Expand Up @@ -118,6 +119,14 @@ def _render_classification_overview(self, classification_name, template, lang, c
if "pagekind" not in context:
context["pagekind"] = ["list", "tags_page"]
output_name = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path('{}_index'.format(classification_name), None, lang))
blinker.signal('generate_classification_overview').send({
'site': self.site,
'classification_name': classification_name,
'lang': lang,
'context': context,
'kw': kw,
'output_name': output_name,
})
task = self.site.generic_post_list_renderer(
lang,
[],
Expand Down Expand Up @@ -322,6 +331,15 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
kw["index_file"] = self.site.config['INDEX_FILE']
context = copy(context)
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
blinker.signal('generate_classification_page').send({
'site': self.site,
'taxonomy': taxonomy,
'classification': classification,
'lang': lang,
'posts': filtered_posts,
'context': context,
'kw': kw,
})
# Decide what to do
if taxonomy.has_hierarchy and taxonomy.show_list_as_subcategories_list:
# Determine whether there are subcategories
Expand Down
1 change: 1 addition & 0 deletions nikola/post.py
Expand Up @@ -552,6 +552,7 @@ def wrap_encrypt(path, password):
'source': self.translated_source_path(lang),
'dest': dest,
'post': self,
'lang': lang,
})

if self.meta('password'):
Expand Down
5 changes: 2 additions & 3 deletions nikola/utils.py
Expand Up @@ -1766,12 +1766,11 @@ def clone_treenode(treenode, parent=None, acceptor=lambda x: True):
node_clone.indent_levels = treenode.indent_levels
node_clone.indent_change_before = treenode.indent_change_before
node_clone.indent_change_after = treenode.indent_change_after
try:
if hasattr(treenode, 'classification_path'):
# Copy stuff added by taxonomies_classifier plugin
node_clone.classification_path = treenode.classification_path
node_clone.classification_name = treenode.classification_name
except AttributeError:
pass

# Accept this node if there are no children (left) and acceptor fails
if not node_clone.children and not acceptor(treenode):
return None
Expand Down
10 changes: 9 additions & 1 deletion translations/nikola.messages/en.po
Expand Up @@ -147,11 +147,19 @@ msgstr "Posts by %s"
msgid "Toggle navigation"
msgstr "Toggle navigation"

#. Used to format months per year
msgid "{month} {year}"
msgstr "{month} {year}"

#. Used to format a date
msgid "{month} {day}, {year}"
msgstr "{month} {day}, {year}"

msgid "Previous"
msgstr "Previous"

msgid "Up"
msgstr "Up"

msgid "Next"
msgstr "Next"
msgstr "Next"

0 comments on commit 372932b

Please sign in to comment.