Skip to content

Commit

Permalink
Fixing name to other_languages.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed May 23, 2017
1 parent 46de7ef commit ffa45f1
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
34 changes: 17 additions & 17 deletions docs/template-variables.rst
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~
Expand Down
10 changes: 5 additions & 5 deletions nikola/plugin_categories.py
Expand Up @@ -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
Expand Down Expand Up @@ -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': '',
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/archive.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/authors.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/categories.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/sections.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/tags.py
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions nikola/plugins/task/taxonomies.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffa45f1

Please sign in to comment.