Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Try to fix #2496
  • Loading branch information
felixfontein committed Sep 15, 2016
1 parent 91c8957 commit d61927f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
13 changes: 10 additions & 3 deletions nikola/nikola.py
Expand Up @@ -885,14 +885,21 @@ def __init__(self, **config):
self.themes_dirs = ['themes'] + self.config['EXTRA_THEMES_DIRS']

# Avoid redundant compilers
# Remove compilers that match nothing in POSTS/PAGES
# Remove compilers that match nothing in POSTS/PAGES or what other post scanning plugins consider
# And put them in "bad compilers"
pp_exts = set([os.path.splitext(x[0])[1] for x in self.config['post_pages']])
pp_exts = set()
for p in self.plugin_manager.getPluginsOfCategory('PostScanner'):
exts = p.plugin_object.get_appearing_post_extensions()
if exts is None:
pp_exts = None
break
for ext in exts:
pp_exts.add(ext)
self.config['COMPILERS'] = {}
self.disabled_compilers = {}
self.bad_compilers = set([])
for k, v in compilers.items():
if pp_exts.intersection(v):
if pp_exts is None or pp_exts.intersection(v):
self.config['COMPILERS'][k] = sorted(list(v))
else:
self.bad_compilers.add(k)
Expand Down
4 changes: 4 additions & 0 deletions nikola/plugin_categories.py
Expand Up @@ -136,6 +136,10 @@ def _execute(self, options, args):
"""
raise NotImplementedError()

def get_appearing_post_extensions(self):
"""Returns a list of post extensions which appear, or None if such a list cannot be computed efficiently."""
return None


def help(self):
"""Return help text for a command."""
Expand Down
4 changes: 4 additions & 0 deletions nikola/plugins/misc/scan_posts.py
Expand Up @@ -99,3 +99,7 @@ def scan(self):
timeline.append(post)

return timeline

def get_appearing_post_extensions(self):
"""Returns a list of post extensions which appear, or None if such a list cannot be computed efficiently."""
return [os.path.splitext(x[0])[1] for x in self.site.config['post_pages']]

0 comments on commit d61927f

Please sign in to comment.