Skip to content
Permalink
Browse files
Moving default filter registration into Nikola.__init__.
  • Loading branch information
felixfontein committed Jun 4, 2017
1 parent f54db6c commit 30efe17063df2276a45341e02a64b1b8b6708720
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 64 deletions.
@@ -26,8 +26,7 @@

"""Utility functions to help run filters on files.
All filters defined in this module are registered in the
default_filters plugin.
All filters defined in this module are registered in Nikola.__init__.
"""

from functools import wraps
@@ -61,7 +61,7 @@

from .post import Post # NOQA
from .state import Persistor
from . import DEBUG, utils, shortcodes
from . import DEBUG, filters, utils, shortcodes
from .plugin_categories import (
Command,
LateTask,
@@ -974,6 +974,17 @@ def __init__(self, **config):
# Get search path for themes
self.themes_dirs = ['themes'] + self.config['EXTRA_THEMES_DIRS']

# Register default filters
filter_name_format = 'filters.{0}'
for filter_name, filter_definition in filters.__dict__.items():
# Ignore objects whose name starts with an underscore, or which are not callable
if filter_name.startswith('_'):
continue
if not callable(filter_definition):
continue
# Register all other objects as filters
site.register_filter(filter_name_format.format(filter_name), filter_definition)

self._set_global_context_from_config()
# Read data files only if a site exists (Issue #2708)
if self.configured:

This file was deleted.

This file was deleted.

0 comments on commit 30efe17

Please sign in to comment.