Skip to content
Permalink
Browse files

Returning to original names.

  • Loading branch information
felixfontein committed May 25, 2017
1 parent 422acf4 commit 845ef159fcadfac8609971eec906e74686af664d
@@ -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']:
@@ -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."""
@@ -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:
@@ -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)
@@ -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)
@@ -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():
@@ -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."""
@@ -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 845ef15

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