Skip to content

Commit

Permalink
Rename to ALL_PAGE_DEPS for less typing
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 17, 2018
1 parent 9c95801 commit b327543
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions nikola/nikola.py
Expand Up @@ -603,7 +603,7 @@ def __init__(self, **config):
self._GLOBAL_CONTEXT = {}

# dependencies for all pages, not included in global context
self.ALL_PAGE_DEPENDENCIES = {}
self.ALL_PAGE_DEPS = {}

self.config.update(config)

Expand Down Expand Up @@ -687,9 +687,9 @@ def __init__(self, **config):
'front_index_header',
)

self._ALL_PAGE_DEPENDENCIES_TRANSLATABLE = ('rss_path',
'rss_filename_base',
)
self._ALL_PAGE_DEPS_TRANSLATABLE = ('rss_path',
'rss_filename_base',
)
# WARNING: navigation_links SHOULD NOT be added to the list above.
# Themes ask for [lang] there and we should provide it.

Expand Down Expand Up @@ -852,7 +852,7 @@ def __init__(self, **config):
self.register_filter(filter_name_format.format(filter_name), filter_definition)

self._set_global_context_from_config()
self._set_all_page_dependencies_from_config()
self._set_all_page_deps_from_config()
# Read data files only if a site exists (Issue #2708)
if self.configured:
self._set_global_context_from_data()
Expand Down Expand Up @@ -1170,18 +1170,18 @@ def _set_global_context_from_data(self):
# Offer global_data as an alias for data (Issue #2488)
self._GLOBAL_CONTEXT['global_data'] = self._GLOBAL_CONTEXT['data']

def _set_all_page_dependencies_from_config(self):
"""Create dependencies for all pages from configuration.
def _set_all_page_deps_from_config(self):
"""Save dependencies for all pages from configuration.
Changes of values in this dict will force a rebuild of all pages.
Unlike global context, contents are NOT available to templates.
"""
self.ALL_PAGE_DEPENDENCIES['atom_extension'] = self.config.get('ATOM_EXTENSION')
self.ALL_PAGE_DEPENDENCIES['rss_extension'] = self.config.get('RSS_EXTENSION')
self.ALL_PAGE_DEPENDENCIES['rss_path'] = self.config.get('RSS_PATH')
self.ALL_PAGE_DEPENDENCIES['rss_filename_base'] = self.config.get('RSS_FILENAME_BASE')
self.ALL_PAGE_DEPENDENCIES['slug_author_path'] = self.config.get('SLUG_AUTHOR_PATH')
self.ALL_PAGE_DEPENDENCIES['slug_tag_path'] = self.config.get('SLUG_TAG_PATH')
self.ALL_PAGE_DEPS['atom_extension'] = self.config.get('ATOM_EXTENSION')
self.ALL_PAGE_DEPS['rss_extension'] = self.config.get('RSS_EXTENSION')
self.ALL_PAGE_DEPS['rss_path'] = self.config.get('RSS_PATH')
self.ALL_PAGE_DEPS['rss_filename_base'] = self.config.get('RSS_FILENAME_BASE')
self.ALL_PAGE_DEPS['slug_author_path'] = self.config.get('SLUG_AUTHOR_PATH')
self.ALL_PAGE_DEPS['slug_tag_path'] = self.config.get('SLUG_TAG_PATH')

def _activate_plugins_of_category(self, category):
"""Activate all the plugins of a given category and return them."""
Expand Down Expand Up @@ -2155,7 +2155,7 @@ def generic_renderer(self, lang, output_name, template_name, filters, file_deps=
deps_dict['OUTPUT_FOLDER'] = self.config['OUTPUT_FOLDER']
deps_dict['TRANSLATIONS'] = self.config['TRANSLATIONS']
deps_dict['global'] = self.GLOBAL_CONTEXT
deps_dict['all_page_dependencies'] = self.ALL_PAGE_DEPENDENCIES
deps_dict['all_page_deps'] = self.ALL_PAGE_DEPS
if post_deps_dict:
deps_dict.update(post_deps_dict)

Expand All @@ -2164,8 +2164,8 @@ def generic_renderer(self, lang, output_name, template_name, filters, file_deps=

for k in self._GLOBAL_CONTEXT_TRANSLATABLE:
deps_dict[k] = deps_dict['global'][k](lang)
for k in self._ALL_PAGE_DEPENDENCIES_TRANSLATABLE:
deps_dict[k] = deps_dict['all_page_dependencies'][k](lang)
for k in self._ALL_PAGE_DEPS_TRANSLATABLE:
deps_dict[k] = deps_dict['all_page_deps'][k](lang)

deps_dict['navigation_links'] = deps_dict['global']['navigation_links'](lang)

Expand Down Expand Up @@ -2291,12 +2291,12 @@ def atom_link(link_rel, link_type, link_href):
deps_context["posts"] = [(p.meta[lang]['title'], p.permalink(lang)) for p in
posts]
deps_context["global"] = self.GLOBAL_CONTEXT
deps_context["all_page_dependencies"] = self.ALL_PAGE_DEPENDENCIES
deps_context["all_page_deps"] = self.ALL_PAGE_DEPS

for k in self._GLOBAL_CONTEXT_TRANSLATABLE:
deps_context[k] = deps_context['global'][k](lang)
for k in self._ALL_PAGE_DEPENDENCIES_TRANSLATABLE:
deps_context[k] = deps_context['all_page_dependencies'][k](lang)
for k in self._ALL_PAGE_DEPS_TRANSLATABLE:
deps_context[k] = deps_context['all_page_deps'][k](lang)

deps_context['navigation_links'] = deps_context['global']['navigation_links'](lang)

Expand Down

0 comments on commit b327543

Please sign in to comment.