Skip to content

Commit 372932b

Browse files
authoredDec 25, 2016
Merge branch 'master' into archive-navigation
2 parents e83d413 + 7670c14 commit 372932b

File tree

11 files changed

+59
-11
lines changed

11 files changed

+59
-11
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ New in master
44
Bugfixes
55
--------
66

7+
* Make ``AUTHOR_PAGES_ARE_INDEXES`` really work (Issue #2600)
78
* WordPress importer now correctly handles & etc. in tags.
89
(Issue #2557)
910
* If ``CODE_COLOR_SCHEME`` is empty, don’t generate ``code.css``

‎nikola/data/themes/base-jinja/templates/authorindex.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{% block extra_head %}
55
{{ super() }}
6-
{% if tranlations|length > 1 and generate_atom %}
6+
{% if translations|length > 1 and generate_atom %}
77
{% for language in translations|sort %}
88
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ author|e }} section ({{ language }})" href="{{ _link(kind + "_atom", author, language) }}">
99
{% endfor %}

‎nikola/data/themes/base/messages/messages_en.py

+2
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@
4444
"Write your post here.": "Write your post here.",
4545
"old posts, page %d": "old posts, page %d",
4646
"page %d": "page %d",
47+
"{month} {day}, {year}": "{month} {day}, {year}",
48+
"{month} {year}": "{month} {year}",
4749
}

‎nikola/data/themes/base/templates/authorindex.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<%block name="extra_head">
55
${parent.extra_head()}
6-
%if len(tranlations) > 1 and generate_atom:
6+
%if len(translations) > 1 and generate_atom:
77
%for language in sorted(translations):
88
<link rel="alternate" type="application/atom+xml" title="Atom for the ${author|h} section (${language})" href="${_link(kind + "_atom", author, language)}">
99
%endfor

‎nikola/nikola.py

+8
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,14 @@ def generic_page_renderer(self, lang, post, filters, context=None):
21682168
if post:
21692169
deps_dict['post_translations'] = post.translated_to
21702170

2171+
signal('render_post').send({
2172+
'site': self,
2173+
'post': post,
2174+
'lang': lang,
2175+
'context': context,
2176+
'deps_dict': deps_dict,
2177+
})
2178+
21712179
yield self.generic_renderer(lang, output_name, post.template_name, filters,
21722180
file_deps=deps,
21732181
uptodate_deps=uptodate_deps,

‎nikola/plugins/misc/taxonomies_classifier.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040

4141

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

45-
name = "render_taxonomies"
45+
name = "classify_taxonomies"
4646

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

196197
def _get_filtered_list(self, taxonomy, classification, lang):
197198
"""Return the filtered list of posts for this classification and language."""

‎nikola/plugins/task/archive.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,20 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
9999
elif len(classification) == 1:
100100
return classification[0]
101101
elif len(classification) == 2:
102-
return nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
102+
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
103+
if only_last_component:
104+
return month
105+
else:
106+
year = classification[0]
107+
return self.site.MESSAGES[lang]['{month} {year}'].format(year=year, month=month)
103108
else:
104-
# Fallback
105-
return '/'.join(classification)
109+
day = int(classification[2])
110+
if only_last_component:
111+
return str(day)
112+
else:
113+
year = classification[0]
114+
month = nikola.utils.LocaleBorg().get_month_name(int(classification[1]), lang)
115+
return self.site.MESSAGES[lang]['{month} {day}, {year}'].format(year=year, month=month, day=day)
106116

107117
def get_path(self, classification, lang, dest_type='page'):
108118
"""A path handler for the given classification."""

‎nikola/plugins/task/taxonomies.py

+18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"""Render the taxonomy overviews, classification pages and feeds."""
2828

2929
from __future__ import unicode_literals
30+
import blinker
3031
import os
3132
import natsort
3233
from copy import copy
@@ -118,6 +119,14 @@ def _render_classification_overview(self, classification_name, template, lang, c
118119
if "pagekind" not in context:
119120
context["pagekind"] = ["list", "tags_page"]
120121
output_name = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path('{}_index'.format(classification_name), None, lang))
122+
blinker.signal('generate_classification_overview').send({
123+
'site': self.site,
124+
'classification_name': classification_name,
125+
'lang': lang,
126+
'context': context,
127+
'kw': kw,
128+
'output_name': output_name,
129+
})
121130
task = self.site.generic_post_list_renderer(
122131
lang,
123132
[],
@@ -322,6 +331,15 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
322331
kw["index_file"] = self.site.config['INDEX_FILE']
323332
context = copy(context)
324333
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
334+
blinker.signal('generate_classification_page').send({
335+
'site': self.site,
336+
'taxonomy': taxonomy,
337+
'classification': classification,
338+
'lang': lang,
339+
'posts': filtered_posts,
340+
'context': context,
341+
'kw': kw,
342+
})
325343
# Decide what to do
326344
if taxonomy.has_hierarchy and taxonomy.show_list_as_subcategories_list:
327345
# Determine whether there are subcategories

‎nikola/post.py

+1
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ def wrap_encrypt(path, password):
552552
'source': self.translated_source_path(lang),
553553
'dest': dest,
554554
'post': self,
555+
'lang': lang,
555556
})
556557

557558
if self.meta('password'):

‎nikola/utils.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1766,12 +1766,11 @@ def clone_treenode(treenode, parent=None, acceptor=lambda x: True):
17661766
node_clone.indent_levels = treenode.indent_levels
17671767
node_clone.indent_change_before = treenode.indent_change_before
17681768
node_clone.indent_change_after = treenode.indent_change_after
1769-
try:
1769+
if hasattr(treenode, 'classification_path'):
17701770
# Copy stuff added by taxonomies_classifier plugin
17711771
node_clone.classification_path = treenode.classification_path
17721772
node_clone.classification_name = treenode.classification_name
1773-
except AttributeError:
1774-
pass
1773+
17751774
# Accept this node if there are no children (left) and acceptor fails
17761775
if not node_clone.children and not acceptor(treenode):
17771776
return None

‎translations/nikola.messages/en.po

+9-1
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,19 @@ msgstr "Posts by %s"
147147
msgid "Toggle navigation"
148148
msgstr "Toggle navigation"
149149

150+
#. Used to format months per year
151+
msgid "{month} {year}"
152+
msgstr "{month} {year}"
153+
154+
#. Used to format a date
155+
msgid "{month} {day}, {year}"
156+
msgstr "{month} {day}, {year}"
157+
150158
msgid "Previous"
151159
msgstr "Previous"
152160

153161
msgid "Up"
154162
msgstr "Up"
155163

156164
msgid "Next"
157-
msgstr "Next"
165+
msgstr "Next"

0 commit comments

Comments
 (0)
Please sign in to comment.