Skip to content
Permalink
Browse files

Merge pull request #2583 from getnikola/improving-taxonomy-plugin-dea…

…ctivation

Improving taxonomy plugin deactivation
  • Loading branch information...
felixfontein committed Dec 5, 2016
2 parents eb1ebfb + dd1dd81 commit 122380ae737f853ebb1efbc5546b6b3ff7a6e02d
Showing with 23 additions and 4 deletions.
  1. +22 −3 nikola/nikola.py
  2. +1 −1 nikola/plugins/task/tagcloud.plugin
@@ -351,6 +351,14 @@
}
}

# Mapping old pre-taxonomy plugin names to new post-taxonomy plugin names
TAXONOMY_COMPATIBILITY_PLUGIN_NAME_MAP = {
"render_archive": ["classify_archive"],
"render_authors": ["classify_authors"],
"render_indexes": ["classify_indexes", "classify_page_index", "classify_sections"],
"render_tags": ["classify_categories", "render_tag_cloud", "classify_tags"],
}


def _enclosure(post, lang):
"""Add an enclosure to RSS."""
@@ -798,14 +806,25 @@ def __init__(self, **config):
utils.LOGGER.warn('The moot comment system has been renamed to muut by the upstream. Setting COMMENT_SYSTEM to "muut".')
self.config['COMMENT_SYSTEM'] = 'muut'

# Handle old plugin names (from before merging the taxonomy PR #2535)
for old_plugin_name, new_plugin_names in TAXONOMY_COMPATIBILITY_PLUGIN_NAME_MAP.items():
if old_plugin_name in self.config['DISABLED_PLUGINS']:
missing_plugins = []
for plugin_name in new_plugin_names:
if plugin_name not in self.config['DISABLED_PLUGINS']:
missing_plugins.append(plugin_name)
if missing_plugins:
utils.LOGGER.warn('The "{}" plugin was replaced by several taxonomy plugins (see PR #2535): {}'.format(old_plugin_name, ', '.join(new_plugin_names)))
utils.LOGGER.warn('You are currently disabling "{}", but not the following new taxonomy plugins: {}'.format(old_plugin_name, ', '.join(missing_plugins)))
utils.LOGGER.warn('Please also disable these new plugins or remove "{}" from the DISABLED_PLUGINS list.'.format(old_plugin_name))
self.config['DISABLED_PLUGINS'].extend(missing_plugins)

# Disable RSS. For a successful disable, we must have both the option
# false and the plugin disabled through the official means.
if 'generate_rss' in self.config['DISABLED_PLUGINS'] and self.config['GENERATE_RSS'] is True:
utils.LOGGER.warn('Please use GENERATE_RSS to disable RSS feed generation, instead of mentioning generate_rss in DISABLED_PLUGINS.')
self.config['GENERATE_RSS'] = False

if not self.config['GENERATE_RSS'] and 'generate_rss' not in self.config['DISABLED_PLUGINS']:
self.config['DISABLED_PLUGINS'].append('generate_rss')

# PRETTY_URLS defaults to enabling STRIP_INDEXES unless explicitly disabled
if self.config.get('PRETTY_URLS') and 'STRIP_INDEXES' not in config:
self.config['STRIP_INDEXES'] = True
@@ -1,5 +1,5 @@
[Core]
name = tagcloud
name = render_tag_cloud
module = tagcloud

[Documentation]

0 comments on commit 122380a

Please sign in to comment.
You can’t perform that action at this time.