Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improving show_list_as_subcategories_list API.
  • Loading branch information
felixfontein committed Nov 27, 2016
1 parent 700e0b0 commit ad11c44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
15 changes: 10 additions & 5 deletions nikola/plugin_categories.py
Expand Up @@ -515,17 +515,21 @@ class Taxonomy(BasePlugin):
posts into the list for the empty hierarchy [].
show_list_as_subcategories_list = False:
If not False, for every classification which has at least one
If True, for every classification which has at least one
subclassification, create a list of subcategories instead of a list/index
of posts. This is only used when has_hierarchy = True. If not False, this
must be the template name for the list; usually "list.tmpl".
If this is set to a string, it is recommended to set
include_posts_from_subhierarchies to True to get correct post counts.
of posts. This is only used when has_hierarchy = True. The template
specified in subcategories_list_template will be used. If this is set
to True, it is recommended to set include_posts_from_subhierarchies to
True to get correct post counts.
show_list_as_index = False:
Whether to show the posts for one classification as an index or
as a post list.
subcategories_list_template = "taxonomy_list":
The template to use for the subcategories list when
show_list_as_subcategories_list is True.
generate_atom_feeds_for_post_lists = False:
Whether to generate Atom feeds for post lists in case GENERATE_ATOM is set.
Expand Down Expand Up @@ -571,6 +575,7 @@ class Taxonomy(BasePlugin):
include_posts_into_hierarchy_root = False
show_list_as_subcategories_list = False
show_list_as_index = False
subcategories_list_template = "taxonomy_list"
generate_atom_feeds_for_post_lists = False
template_for_single_list = "tagindex.tmpl"
template_for_classification_overview = "list.tmpl"
Expand Down
3 changes: 2 additions & 1 deletion nikola/plugins/task/archive.py
Expand Up @@ -44,6 +44,7 @@ class Archive(Taxonomy):
has_hierarchy = True
include_posts_from_subhierarchies = True
include_posts_into_hierarchy_root = True
subcategories_list_template = "list.tmpl"
generate_atom_feeds_for_post_lists = False
template_for_classification_overview = None
always_disable_rss = True
Expand All @@ -59,7 +60,7 @@ def set_site(self, site):
if (site.config['CREATE_MONTHLY_ARCHIVE'] and site.config['CREATE_SINGLE_ARCHIVE']) and not site.config['CREATE_FULL_ARCHIVES']:
raise Exception('Cannot create monthly and single archives at the same time.')
# Finish setup
self.show_list_as_subcategories_list = False if site.config['CREATE_FULL_ARCHIVES'] else "list.tmpl"
self.show_list_as_subcategories_list = not site.config['CREATE_FULL_ARCHIVES']
self.show_list_as_index = site.config['ARCHIVES_ARE_INDEXES']
self.template_for_single_list = "archiveindex.tmpl" if site.config['ARCHIVES_ARE_INDEXES'] else "list_post.tmpl"
# Determine maximum hierarchy height
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/taxonomies.py
Expand Up @@ -235,7 +235,7 @@ def get_subnode_data(subnode):
lang,
[],
os.path.join(kw['output_folder'], self.site.path(taxonomy.classification_name, node.classification_name, lang)),
taxonomy.show_list_as_subcategories_list,
taxonomy.subcategories_list_template,
kw['filters'],
context,
)
Expand Down

0 comments on commit ad11c44

Please sign in to comment.