Skip to content
Permalink
Browse files
Fixing name to other_languages.
  • Loading branch information
felixfontein committed May 23, 2017
1 parent 46de7ef commit ffa45f1a48a97d8aac3206e2cb7c17a8b3e5b5a9
@@ -247,29 +247,29 @@ Classification pages (lists)

.. class:: table table-bordered table-striped

================================== ============== =============================================================
Name Type Description
================================== ============== =============================================================
``kind`` str The classification name
``items`` list? List of items for ``list.tmpl`` *(title, permalink, None)*
``posts`` list<Post>? List of items for other templates
``kind`` str The classification name
``permalink`` str Permanent link to page
``<other_language_variable_name>`` list<tuple> List of triples ``(other_lang, other_classification, title)``
================================== ============== =============================================================
=================== ============== =============================================================
Name Type Description
=================== ============== =============================================================
``kind`` str The classification name
``items`` list? List of items for ``list.tmpl`` *(title, permalink, None)*
``posts`` list<Post>? List of items for other templates
``kind`` str The classification name
``permalink`` str Permanent link to page
``other_languages`` list<tuple> List of triples ``(other_lang, other_classification, title)``
=================== ============== =============================================================

Subclassification page
~~~~~~~~~~~~~~~~~~~~~~

.. class:: table table-bordered table-striped

================================== =========== =============================================================
Name Type Description
================================== =========== =============================================================
``items`` list? List of items
``permalink`` str Permanent link to page
``<other_language_variable_name>`` list<tuple> List of triples ``(other_lang, other_classification, title)``
================================== =========== =============================================================
=================== =========== =============================================================
Name Type Description
=================== =========== =============================================================
``items`` list? List of items
``permalink`` str Permanent link to page
``other_languages`` list<tuple> List of triples ``(other_lang, other_classification, title)``
=================== =========== =============================================================

Hierarchical lists
~~~~~~~~~~~~~~~~~~
@@ -602,11 +602,11 @@ class Taxonomy(BasePlugin):
language, or only the classifications for one language in its language's
pages.
other_language_variable_name = None:
In case this is not `None`, each classification page will get a list
add_other_languages_variable = False:
In case this is `True`, each classification page will get a list
of triples `(other_lang, other_classification, title)` of classifications
in other languages which should be linked. The list will be stored in a
variable by the name `other_language_variable_name`.
in other languages which should be linked. The list will be stored in the
variable `other_languages`.
path_handler_docstrings:
A dictionary of docstrings for path handlers. See eg. nikola.py for
@@ -639,7 +639,7 @@ class Taxonomy(BasePlugin):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = False
also_create_classifications_from_other_languages = True
other_language_variable_name = None
add_other_languages_variable = False
path_handler_docstrings = {
'taxonomy_index': '',
'taxonomy': '',
@@ -53,7 +53,7 @@ class Archive(Taxonomy):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = False
also_create_classifications_from_other_languages = False
other_language_variable_name = 'other_languages'
add_other_languages_variable = True
path_handler_docstrings = {
'archive_index': False,
'archive': """Link to archive path, name is the year.
@@ -48,7 +48,7 @@ class ClassifyAuthors(Taxonomy):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = False
also_create_classifications_from_other_languages = False
other_language_variable_name = 'other_languages'
add_other_languages_variable = True
path_handler_docstrings = {
'author_index': """ Link to the authors index.
@@ -54,7 +54,7 @@ class ClassifyCategories(Taxonomy):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = True
also_create_classifications_from_other_languages = True
other_language_variable_name = 'other_languages'
add_other_languages_variable = True
path_handler_docstrings = {
'category_index': """A link to the category index.
@@ -47,7 +47,7 @@ class ClassifySections(Taxonomy):
apply_to_pages = False
omit_empty_classifications = True
also_create_classifications_from_other_languages = False
other_language_variable_name = 'other_languages'
add_other_languages_variable = True
path_handler_docstrings = {
'section_index_index': False,
'section_index': """Link to the index for a section.
@@ -50,7 +50,7 @@ class ClassifyTags(Taxonomy):
apply_to_pages = False
omit_empty_classifications = True
also_create_classifications_from_other_languages = True
other_language_variable_name = 'other_languages'
add_other_languages_variable = True
path_handler_docstrings = {
'tag_index': """A link to the tag index.
@@ -348,8 +348,8 @@ def _generate_classification_page(self, taxonomy, classification, filtered_posts
taxonomy.get_classification_friendly_name(classification, other_lang))
for classification in links if post_lists_per_lang[other_lang].get(classification, ('', False, False))[1]])
# Store result in context and kw
context[taxonomy.other_language_variable_name] = sorted_links
kw[taxonomy.other_language_variable_name] = sorted_links
context['other_languages'] = sorted_links
kw['other_languages'] = sorted_links
# Allow other plugins to modify the result
blinker.signal('generate_classification_page').send({
'site': self.site,
@@ -385,10 +385,10 @@ def gen_tasks(self):
yield self.group_task()

# Cache classification sets per language for taxonomies where
# other_language_variable_name is set.
# add_other_languages_variable is True.
classification_set_per_lang = {}
for taxonomy in self.site.taxonomy_plugins.values():
if taxonomy.other_language_variable_name is not None:
if taxonomy.add_other_languages_variable:
lookup = self.site.posts_per_classification[taxonomy.classification_name]
cspl = {lang: set(lookup[lang].keys()) for lang in lookup}
classification_set_per_lang[taxonomy.classification_name] = cspl

0 comments on commit ffa45f1

Please sign in to comment.