Skip to content
Permalink
Browse files
MAke tests pass
  • Loading branch information
ralsina committed Mar 18, 2018
1 parent 08f6a3f commit 5e84a44a45695e88a74569da41d2e808c23e280e
Showing with 7 additions and 4 deletions.
  1. +5 −3 nikola/plugins/compile/markdown/__init__.py
  2. +1 −0 tests/base.py
  3. +1 −1 tests/test_compile_markdown.py
@@ -92,17 +92,19 @@ def set_site(self, site):
extensions.extend(site_extensions)

site_extension_configs = self.site.config.get("MARKDOWN_EXTENSION_CONFIGS", {})
self.config_dependencies.append(json.dumps(site_extension_configs.values, sort_keys=True))
if site_extension_configs:
self.config_dependencies.append(json.dumps(site_extension_configs.values, sort_keys=True))

if Markdown is not None:
self.converters = {}
for lang in self.site.config['TRANSLATIONS']:
self.converters[lang] = ThreadLocalMarkdown(extensions, site_extension_configs[lang])
self.converters[lang] = ThreadLocalMarkdown(extensions, site_extension_configs.get(lang, {}))
self.supports_metadata = 'markdown.extensions.meta' in extensions

def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""Compile Markdown into HTML strings."""
lang = lang or self.site.config.DEFAULT_LANGUAGE
if lang is None:
lang = LocaleBorg().current_lang
if Markdown is None:
req_missing(['markdown'], 'build this site (compile Markdown)')
if not is_two_file:
@@ -175,6 +175,7 @@ def __init__(self):
'MARKDOWN_EXTENSIONS': ['markdown.extensions.fenced_code', 'markdown.extensions.codehilite'],
'TRANSLATIONS_PATTERN': '{path}.{lang}.{ext}',
'LISTINGS_FOLDERS': {'listings': 'listings'},
'TRANSLATIONS': {'en': ''},
}
self.EXTRA_PLUGINS = self.config['EXTRA_PLUGINS']
self.plugin_manager = PluginManager(categories_filter={
@@ -23,7 +23,7 @@ def compile(self, input_string):
with io.open(self.input_path, "w+", encoding="utf8") as input_file:
input_file.write(input_string)

self.compiler.compile(self.input_path, self.output_path)
self.compiler.compile(self.input_path, self.output_path, lang='en')

output_str = None
with io.open(self.output_path, "r", encoding="utf8") as output_path:

0 comments on commit 5e84a44

Please sign in to comment.