Skip to content

Commit

Permalink
Improving naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Dec 2, 2016
1 parent 91b1f05 commit e91fe1d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions nikola/plugin_categories.py
Expand Up @@ -526,12 +526,12 @@ class Taxonomy(BasePlugin):
Whether the classification has a hierarchy.
include_posts_from_subhierarchies = False:
If True, the list for a classification includes all posts with a
If True, the post list for a classification includes all posts with a
sub-classification (in case has_hierarchy is True).
include_posts_into_hierarchy_root = False:
If True, include_posts_from_subhierarchies == True will also insert
posts into the list for the empty hierarchy [].
posts into the post list for the empty hierarchy [].
show_list_as_subcategories_list = False:
If True, for every classification which has at least one
Expand Down Expand Up @@ -673,8 +673,8 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
"""
raise NotImplementedError()

def get_list_path(self, lang, type='page'):
"""A path handler for the list of all classifications.
def get_overview_path(self, lang, type='page'):
"""A path handler for the classification overview.
Must return one or two values (in this order):
* a list or tuple of strings: the path relative to OUTPUT_DIRECTORY;
Expand Down Expand Up @@ -735,8 +735,8 @@ def recombine_classification_from_hierarchy(self, hierarchy):
"""
return hierarchy[0]

def provide_list_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the list of all classifiations.
def provide_overview_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the classifiation overview.
Must return a tuple of two dicts. The first is merged into the page's context,
the second will be put into the uptodate list of all generated tasks.
Expand All @@ -758,7 +758,7 @@ def provide_context_and_uptodate(self, classification, lang, node=None):
"""
raise NotImplementedError()

def should_generate_classification_list(self, classification, post_list, lang):
def should_generate_classification_page(self, classification, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
return True

Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/misc/taxonomies_classifier.py
Expand Up @@ -263,7 +263,7 @@ def _postprocess_path(self, path, lang, append_index='auto', type='page', page_i

@staticmethod
def _parse_path_result(result):
"""Interpret the return values of taxonomy.get_path() and taxonomy.get_list_path() as if all three return values were given."""
"""Interpret the return values of taxonomy.get_path() and taxonomy.get_overview_path() as if all three return values were given."""
if not isinstance(result[0], (list, tuple)):
# The result must be a list or tuple of strings. Wrap into a tuple
result = (result, )
Expand All @@ -274,7 +274,7 @@ def _parse_path_result(result):

def _taxonomy_index_path(self, lang, taxonomy):
"""Return path to the classification overview."""
result = taxonomy.get_list_path(lang)
result = taxonomy.get_overview_path(lang)
path, append_index, _ = self._parse_path_result(result)
return self._postprocess_path(path, lang, append_index=append_index, type='list')

Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/archive.py
Expand Up @@ -161,6 +161,6 @@ def provide_context_and_uptodate(self, classification, lang, node=None):
kw.update(context)
return context, kw

def should_generate_classification_list(self, classification, post_list, lang):
def should_generate_classification_page(self, classification, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
return len(classification.split('/')) < 3 or len(post_list) > 0
4 changes: 2 additions & 2 deletions nikola/plugins/task/authors.py
Expand Up @@ -72,7 +72,7 @@ def get_classification_friendly_name(self, author, lang, only_last_component=Fal
"""Extract a friendly name from the classification."""
return author

def get_list_path(self, lang, type='page'):
def get_overview_path(self, lang, type='page'):
"""A path handler for the list of all classifications."""
return [self.site.config['AUTHOR_PATH']], 'always'

Expand All @@ -84,7 +84,7 @@ def get_path(self, author, lang, type='page'):
slug = author
return [self.site.config['AUTHOR_PATH'], slug], 'auto'

def provide_list_context_and_uptodate(self, lang):
def provide_overview_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the list of all classifiations."""
kw = {
"messages": self.site.MESSAGES,
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/categories.py
Expand Up @@ -81,7 +81,7 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo
classification = self.extract_hierarchy(classification)
return classification[-1] if classification else ''

def get_list_path(self, lang, type='page'):
def get_overview_path(self, lang, type='page'):
"""A path handler for the list of all classifications."""
if self.site.config['CATEGORIES_INDEX_PATH'][lang]:
return [_f for _f in [self.site.config['CATEGORIES_INDEX_PATH'][lang]] if _f], 'never'
Expand Down Expand Up @@ -123,7 +123,7 @@ def recombine_classification_from_hierarchy(self, hierarchy):
"""Given a list of parts in the hierarchy, return the classification string."""
return utils.join_hierarchical_category_path(hierarchy)

def provide_list_context_and_uptodate(self, lang):
def provide_overview_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the list of all classifiations."""
kw = {
'category_path': self.site.config['CATEGORY_PATH'],
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/task/page_index.py
Expand Up @@ -94,7 +94,7 @@ def provide_context_and_uptodate(self, dirname, lang, node=None):
kw.update(context)
return context, kw

def should_generate_classification_list(self, dirname, post_list, lang):
def should_generate_classification_page(self, dirname, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
short_destination = dirname + '/' + self.site.config['INDEX_FILE']
for post in post_list:
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/tags.py
Expand Up @@ -87,7 +87,7 @@ def slugify_tag_name(self, name, lang):
name = utils.slugify(name, lang)
return name

def get_list_path(self, lang, type='page'):
def get_overview_path(self, lang, type='page'):
"""A path handler for the list of all classifications."""
if self.site.config['TAGS_INDEX_PATH'][lang]:
return [_f for _f in [self.site.config['TAGS_INDEX_PATH'][lang]] if _f], 'never'
Expand All @@ -100,7 +100,7 @@ def get_path(self, classification, lang, type='page'):
self.site.config['TAG_PATH'][lang],
self.slugify_tag_name(classification, lang)] if _f], 'auto'

def provide_list_context_and_uptodate(self, lang):
def provide_overview_context_and_uptodate(self, lang):
"""Provide data for the context and the uptodate list for the list of all classifiations."""
kw = {
"tag_path": self.site.config['TAG_PATH'],
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/taxonomies.py
Expand Up @@ -73,7 +73,7 @@ class RenderTaxonomies(Task):

def _generate_classification_overview_kw_context(self, taxonomy, lang):
"""Create context and kw for a classification overview page."""
context, kw = taxonomy.provide_list_context_and_uptodate(lang)
context, kw = taxonomy.provide_overview_context_and_uptodate(lang)

context = copy(context)
kw = copy(kw)
Expand Down Expand Up @@ -324,7 +324,7 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
if len(filtered_posts) == 0 and taxonomy.omit_empty_classifications:
return
# Should we create this list?
if not taxonomy.should_generate_classification_list(classification, filtered_posts, lang):
if not taxonomy.should_generate_classification_page(classification, filtered_posts, lang):
return
# Get data
node = None
Expand Down

0 comments on commit e91fe1d

Please sign in to comment.