Skip to content
Permalink
Browse files
Use get_compiler_extensions, fix #147
  • Loading branch information
ralsina committed Jun 3, 2016
1 parent f205c97 commit e885486f256afd92b067dfddce52e3aee387c7a6
Showing with 13 additions and 10 deletions.
  1. +13 −10 v7/rest_html5/rest_html5.py
@@ -46,7 +46,7 @@
has_rst2html5 = False

from nikola.plugin_categories import PageCompiler
from nikola.utils import get_logger, makedirs, req_missing, write_metadata
from nikola.utils import unicode_str, get_logger, makedirs, write_metadata, STDERR_HANDLER


class CompileRestHTML5(PageCompiler):
@@ -135,22 +135,25 @@ def create_post(self, path, **kw):
fd.write(content)

def set_site(self, site):
"""Set Nikola site."""
super(CompileRestHTML5, self).set_site(site)
self.config_dependencies = []
for plugin_info in site.plugin_manager.getPluginsOfCategory("RestExtension"):
if plugin_info.name in site.config['DISABLED_PLUGINS']:
site.plugin_manager.removePluginFromCategory(plugin_info, "RestExtension")
continue

site.plugin_manager.activatePluginByName(plugin_info.name)
for plugin_info in self.get_compiler_extensions():
self.config_dependencies.append(plugin_info.name)
plugin_info.plugin_object.set_site(site)
plugin_info.plugin_object.short_help = plugin_info.description

self.logger = get_logger('compile_rest', site.loghandlers)
self.logger = get_logger('compile_rest', STDERR_HANDLER)
if not site.debug:
self.logger.level = 4

return super(CompileRestHTML5, self).set_site(site)
def get_compiler_extensions(self):
"""This plugin uses rest compiler extensions."""
plugins = []
for plugin_info in self.site.compiler_extensions:
if plugin_info.plugin_object.compiler_name == 'rest':
plugins.append(plugin_info)
return plugins



def get_observer(settings):

0 comments on commit e885486

Please sign in to comment.