Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5e84a44

Browse files
committedMar 18, 2018
MAke tests pass
1 parent 08f6a3f commit 5e84a44

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed
 

‎nikola/plugins/compile/markdown/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,19 @@ def set_site(self, site):
9292
extensions.extend(site_extensions)
9393

9494
site_extension_configs = self.site.config.get("MARKDOWN_EXTENSION_CONFIGS", {})
95-
self.config_dependencies.append(json.dumps(site_extension_configs.values, sort_keys=True))
95+
if site_extension_configs:
96+
self.config_dependencies.append(json.dumps(site_extension_configs.values, sort_keys=True))
9697

9798
if Markdown is not None:
9899
self.converters = {}
99100
for lang in self.site.config['TRANSLATIONS']:
100-
self.converters[lang] = ThreadLocalMarkdown(extensions, site_extension_configs[lang])
101+
self.converters[lang] = ThreadLocalMarkdown(extensions, site_extension_configs.get(lang, {}))
101102
self.supports_metadata = 'markdown.extensions.meta' in extensions
102103

103104
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
104105
"""Compile Markdown into HTML strings."""
105-
lang = lang or self.site.config.DEFAULT_LANGUAGE
106+
if lang is None:
107+
lang = LocaleBorg().current_lang
106108
if Markdown is None:
107109
req_missing(['markdown'], 'build this site (compile Markdown)')
108110
if not is_two_file:

‎tests/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def __init__(self):
175175
'MARKDOWN_EXTENSIONS': ['markdown.extensions.fenced_code', 'markdown.extensions.codehilite'],
176176
'TRANSLATIONS_PATTERN': '{path}.{lang}.{ext}',
177177
'LISTINGS_FOLDERS': {'listings': 'listings'},
178+
'TRANSLATIONS': {'en': ''},
178179
}
179180
self.EXTRA_PLUGINS = self.config['EXTRA_PLUGINS']
180181
self.plugin_manager = PluginManager(categories_filter={

‎tests/test_compile_markdown.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def compile(self, input_string):
2323
with io.open(self.input_path, "w+", encoding="utf8") as input_file:
2424
input_file.write(input_string)
2525

26-
self.compiler.compile(self.input_path, self.output_path)
26+
self.compiler.compile(self.input_path, self.output_path, lang='en')
2727

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

0 commit comments

Comments
 (0)
Please sign in to comment.