Skip to content

Commit

Permalink
Returning to original names.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jun 6, 2017
1 parent efff4a2 commit 19f8ea7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions nikola/plugins/task/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def provide_context_and_uptodate(self, classification, lang, node=None):
kw.update(context)
return context, kw

def postprocess_posts_per_classification(self, posts_per_archive_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
# Build a lookup table for archive navigation, if we’ll need one.
if self.site.config['CREATE_ARCHIVE_NAVIGATION']:
Expand All @@ -227,15 +227,15 @@ def postprocess_posts_per_classification(self, posts_per_archive_per_language, f
self.archive_navigation[lang] = defaultdict(list)
for node in flat_hierarchy:
if not self.site.config["SHOW_UNTRANSLATED_POSTS"]:
if not [x for x in posts_per_archive_per_language[lang][node.classification_name] if x.is_translation_available(lang)]:
if not [x for x in posts_per_classification_per_language[lang][node.classification_name] if x.is_translation_available(lang)]:
continue
self.archive_navigation[lang][len(node.classification_path)].append(node.classification_name)

# We need to sort it. Natsort means it’s year 10000 compatible!
for k, v in self.archive_navigation[lang].items():
self.archive_navigation[lang][k] = natsort.natsorted(v, alg=natsort.ns.F | natsort.ns.IC)

return super(Archive, self).postprocess_posts_per_classification(posts_per_archive_per_language, flat_hierarchy_per_lang, hierarchy_lookup_per_lang)
return super(Archive, self).postprocess_posts_per_classification(posts_per_classification_per_language, flat_hierarchy_per_lang, hierarchy_lookup_per_lang)

def should_generate_classification_page(self, classification, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
Expand Down
6 changes: 3 additions & 3 deletions nikola/plugins/task/authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ def get_other_language_variants(self, author, lang, classifications_per_language
"""Return a list of variants of the same author in other languages."""
return self.translation_manager.get_translations_as_list(author, lang)

def postprocess_posts_per_classification(self, posts_per_author_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
more_than_one = False
for lang, posts_per_author in posts_per_author_per_language.items():
for lang, posts_per_author in posts_per_classification_per_language.items():
authors = set()
for author, posts in posts_per_author.items():
for post in posts:
Expand All @@ -158,4 +158,4 @@ def postprocess_posts_per_classification(self, posts_per_author_per_language, fl
more_than_one = True
self.generate_author_pages = self.site.config["ENABLE_AUTHOR_PAGES"] and more_than_one
self.site.GLOBAL_CONTEXT["author_pages_generated"] = self.generate_author_pages
self.translation_manager.add_defaults(posts_per_author_per_language)
self.translation_manager.add_defaults(posts_per_classification_per_language)
4 changes: 2 additions & 2 deletions nikola/plugins/task/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ def get_other_language_variants(self, category, lang, classifications_per_langua
"""Return a list of variants of the same category in other languages."""
return self.translation_manager.get_translations_as_list(category, lang)

def postprocess_posts_per_classification(self, posts_per_section_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
self.translation_manager.read_from_config(self.site, 'CATEGORY', posts_per_section_per_language, False)
self.translation_manager.read_from_config(self.site, 'CATEGORY', posts_per_classification_per_language, False)
6 changes: 3 additions & 3 deletions nikola/plugins/task/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def provide_context_and_uptodate(self, section, lang, node=None):
kw.update(context)
return context, kw

def postprocess_posts_per_classification(self, posts_per_section_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
for lang, posts_per_section in posts_per_section_per_language.items():
for lang, posts_per_section in posts_per_classification_per_language.items():
# Don't build sections when there is only one, a.k.a. default setups
sections = set()
for section, posts in posts_per_section.items():
Expand All @@ -141,7 +141,7 @@ def postprocess_posts_per_classification(self, posts_per_section_per_language, f
continue
sections.add(section)
self.enable_for_lang[lang] = (len(sections) > 1)
self.translation_manager.read_from_config(self.site, 'POSTS_SECTION', posts_per_section_per_language, False)
self.translation_manager.read_from_config(self.site, 'POSTS_SECTION', posts_per_classification_per_language, False)

def should_generate_classification_page(self, dirname, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,6 @@ def get_other_language_variants(self, tag, lang, classifications_per_language):
"""Return a list of variants of the same tag in other languages."""
return self.translation_manager.get_translations_as_list(tag, lang)

def postprocess_posts_per_classification(self, posts_per_tag_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_classification_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
self.translation_manager.read_from_config(self.site, 'TAG', posts_per_tag_per_language, False)
self.translation_manager.read_from_config(self.site, 'TAG', posts_per_classification_per_language, False)

0 comments on commit 19f8ea7

Please sign in to comment.