Skip to content

Commit

Permalink
Merge e7941e7 into 010d739
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Dec 3, 2016
2 parents 010d739 + e7941e7 commit 566ad86
Show file tree
Hide file tree
Showing 25 changed files with 1,936 additions and 1,396 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Expand Up @@ -25,6 +25,12 @@ Features
* Pass ``post`` object and ``lang`` to post compilers (Issue #2531)
* Pass ``url_type`` into template's context.
* Make thumbnail naming configurable with ``IMAGE_THUMBNAIL_FORMAT``.
* There is a new plugin category ``Taxonomy`` which allows to easily
create new taxonomies. Some of the existing taxonomies (authors,
archives, indexes, page index, sections, tags, and categories)
have been converted to the new system. (Issue #2107)
* Added ``CATEGORIES_INDEX_PATH``, similar to ``TAGS_INDEX_PATH``.
(Issue #2567)

New in v7.8.1
=============
Expand Down
15 changes: 13 additions & 2 deletions nikola/conf.py.in
Expand Up @@ -287,8 +287,11 @@ POSTS_SECTIONS = True
# (translatable)
# TAG_PATH = "categories"

# See TAG_PATH's "list of tags" for the default setting value. Can be overwritten
# here any path relative to the output directory.
# By default, the list of tags is stored in
# output / TRANSLATION[lang] / TAG_PATH / index.html
# (see explanation for TAG_PATH). This location can be changed to
# output / TRANSLATION[lang] / TAGS_INDEX_PATH
# with an arbitrary relative path TAGS_INDEX_PATH.
# (translatable)
# TAGS_INDEX_PATH = "tags.html"

Expand Down Expand Up @@ -333,6 +336,14 @@ HIDDEN_TAGS = ['mathjax']
# CATEGORY_PATH = "categories"
# CATEGORY_PREFIX = "cat_"

# By default, the list of categories is stored in
# output / TRANSLATION[lang] / CATEGORY_PATH / index.html
# (see explanation for CATEGORY_PATH). This location can be changed to
# output / TRANSLATION[lang] / CATEGORIES_INDEX_PATH
# with an arbitrary relative path CATEGORIES_INDEX_PATH.
# (translatable)
# CATEGORIES_INDEX_PATH = "categories.html"

# If CATEGORY_ALLOW_HIERARCHIES is set to True, categories can be organized in
# hierarchies. For a post, the whole path in the hierarchy must be specified,
# using a forward slash ('/') to separate paths. Use a backslash ('\') to escape
Expand Down
16 changes: 15 additions & 1 deletion nikola/nikola.py
Expand Up @@ -73,6 +73,7 @@
SignalHandler,
ConfigPlugin,
PostScanner,
Taxonomy,
)

if DEBUG:
Expand Down Expand Up @@ -438,6 +439,7 @@ def __init__(self, **config):
'BLOG_DESCRIPTION': 'Default Description',
'BODY_END': "",
'CACHE_FOLDER': 'cache',
'CATEGORIES_INDEX_PATH': '',
'CATEGORY_PATH': None, # None means: same as TAG_PATH
'CATEGORY_PAGES_ARE_INDEXES': None, # None means: same as TAG_PAGES_ARE_INDEXES
'CATEGORY_PAGES_DESCRIPTIONS': {},
Expand Down Expand Up @@ -646,6 +648,7 @@ def __init__(self, **config):
'TAG_PATH',
'TAGS_INDEX_PATH',
'CATEGORY_PATH',
'CATEGORIES_INDEX_PATH',
'DATE_FORMAT',
'JS_DATE_FORMAT',
)
Expand Down Expand Up @@ -949,6 +952,7 @@ def init_plugins(self, commands_only=False, load_all=False):
"SignalHandler": SignalHandler,
"ConfigPlugin": ConfigPlugin,
"PostScanner": PostScanner,
"Taxonomy": Taxonomy,
})
self.plugin_manager.getPluginLocator().setPluginInfoExtension('plugin')
extra_plugins_dirs = self.config['EXTRA_PLUGINS_DIRS']
Expand Down Expand Up @@ -1020,6 +1024,16 @@ def plugin_position_in_places(plugin):

self.plugin_manager.loadPlugins()

self._activate_plugins_of_category("Taxonomy")
self.taxonomy_plugins = {}
for taxonomy in [p.plugin_object for p in self.plugin_manager.getPluginsOfCategory('Taxonomy')]:
if not taxonomy.is_enabled():
continue
if taxonomy.classification_name in self.taxonomy_plugins:
utils.LOGGER.error("Found more than one taxonomy with classification name '{}'!".format(taxonomy.classification_name))
sys.exit(1)
self.taxonomy_plugins[taxonomy.classification_name] = taxonomy

self._activate_plugins_of_category("SignalHandler")

# Emit signal for SignalHandlers which need to start running immediately.
Expand Down Expand Up @@ -2344,7 +2358,7 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont
kw['indexes_prety_page_url'] = self.config["INDEXES_PRETTY_PAGE_URL"]
kw['demote_headers'] = self.config['DEMOTE_HEADERS']
kw['generate_atom'] = self.config["GENERATE_ATOM"]
kw['feed_link_append_query'] = self.config["FEED_LINKS_APPEND_QUERY"]
kw['feed_links_append_query'] = self.config["FEED_LINKS_APPEND_QUERY"]
kw['currentfeed'] = None

# Split in smaller lists
Expand Down

0 comments on commit 566ad86

Please sign in to comment.