Skip to content
Permalink
Browse files
Removing option add_postcount_in_overview (always enabled).
  • Loading branch information
felixfontein committed Dec 3, 2016
1 parent d5d9c8e commit b5bfd49cc38a5b774b3a2792471bbe0d05acb576
Showing with 29 additions and 31 deletions.
  1. +12 −10 nikola/plugin_categories.py
  2. +0 −1 nikola/plugins/task/categories.py
  3. +0 −1 nikola/plugins/task/tags.py
  4. +17 −19 nikola/plugins/task/taxonomies.py
@@ -504,6 +504,11 @@ class Taxonomy(BasePlugin):
(friendly_name, link)
for the classifications available in a variable by this name.
The template will also have a list
(friendly_name, link, post_count)
for the classifications available in a variable by the name
`overview_page_items_variable_name + '_with_postcount'`.
overview_page_variable_name = "taxonomy":
When rendering the overview page, its template will have a list
of classifications available in a variable by this name.
@@ -516,6 +521,13 @@ class Taxonomy(BasePlugin):
available in a variable by this name. These tuples can be used
to render the hierarchy as a tree.
The template will also have a list
(friendly_name, classification, classification_path, link,
indent_levels, indent_change_before, indent_change_after,
number_of_children, post_count)
available in the variable by the name
`overview_page_hierarchy_variable_name + '_with_postcount'`.
more_than_one_classifications_per_post = False:
If True, there can be more than one classification per post; in that case,
the classification data in the metadata is stored as a list. If False,
@@ -559,15 +571,6 @@ class Taxonomy(BasePlugin):
The template to use for the classification overview page.
Set to None to avoid generating overviews.
add_postcount_in_overview = False:
If set to True, two more variables `'items_with_postcount'` and
`overview_page_hierarchy_variable_name + '_with_postcount'` (for
hierarchical taxonomies) besides the `'items'` and
`overview_page_hierarchy_variable_name` will be available in the
overview page's template. These new variables will contain the post
count for every classification, and in case of the hierarchy, also
the number of children for every node.
always_disable_rss = False:
Whether to always disable RSS feed generation
@@ -610,7 +613,6 @@ class Taxonomy(BasePlugin):
generate_atom_feeds_for_post_lists = False
template_for_single_list = "tagindex.tmpl"
template_for_classification_overview = "list.tmpl"
add_postcount_in_overview = False
always_disable_rss = False
apply_to_posts = True
apply_to_pages = False
@@ -53,7 +53,6 @@ class ClassifyCategories(Taxonomy):
show_list_as_subcategories_list = False
generate_atom_feeds_for_post_lists = True
template_for_classification_overview = "tags.tmpl"
add_postcount_in_overview = True
always_disable_rss = False
apply_to_posts = True
apply_to_pages = False
@@ -50,7 +50,6 @@ class ClassifyTags(Taxonomy):
show_list_as_subcategories_list = False
generate_atom_feeds_for_post_lists = True
template_for_classification_overview = "tags.tmpl"
add_postcount_in_overview = True
always_disable_rss = False
apply_to_posts = True
apply_to_pages = False
@@ -109,15 +109,14 @@ def acceptor(node):
items = [(classification,
self.site.link(taxonomy.classification_name, classification, lang))
for classification in classifications]
items_with_postcount = [
(classification,
self.site.link(taxonomy.classification_name, classification, lang),
len(self._filter_list(self.site.posts_per_classification[taxonomy.classification_name][lang][classification], lang)))
for classification in classifications
]
context[taxonomy.overview_page_items_variable_name] = items
if taxonomy.add_postcount_in_overview:
items_with_postcount = [
(classification,
self.site.link(taxonomy.classification_name, classification, lang),
len(self._filter_list(self.site.posts_per_classification[taxonomy.classification_name][lang][classification], lang)))
for classification in classifications
]
context[taxonomy.overview_page_items_variable_name + "_with_postcount"] = items_with_postcount
context[taxonomy.overview_page_items_variable_name + "_with_postcount"] = items_with_postcount
if taxonomy.has_hierarchy and taxonomy.overview_page_hierarchy_variable_name:
hier_items = [
(node.name, node.classification_name, node.classification_path,
@@ -126,18 +125,17 @@ def acceptor(node):
node.indent_change_after)
for node in clipped_flat_hierarchy
]
hier_items_with_postcount = [
(node.name, node.classification_name, node.classification_path,
self.site.link(taxonomy.classification_name, node.classification_name, lang),
node.indent_levels, node.indent_change_before,
node.indent_change_after,
len(node.children),
len(self._filter_list(self.site.posts_per_classification[taxonomy.classification_name][lang][node.classification_name], lang)))
for node in clipped_flat_hierarchy
]
context[taxonomy.overview_page_hierarchy_variable_name] = hier_items
if taxonomy.add_postcount_in_overview:
hier_items_with_postcount = [
(node.name, node.classification_name, node.classification_path,
self.site.link(taxonomy.classification_name, node.classification_name, lang),
node.indent_levels, node.indent_change_before,
node.indent_change_after,
len(node.children),
len(self._filter_list(self.site.posts_per_classification[taxonomy.classification_name][lang][node.classification_name], lang)))
for node in clipped_flat_hierarchy
]
context[taxonomy.overview_page_hierarchy_variable_name + '_with_postcount'] = hier_items_with_postcount
context[taxonomy.overview_page_hierarchy_variable_name + '_with_postcount'] = hier_items_with_postcount
return context, kw

def _render_classification_overview(self, classification_name, template, lang, context, kw):

0 comments on commit b5bfd49

Please sign in to comment.