Skip to content

Commit bc93e97

Browse files
authoredAug 2, 2016
Merge pull request #2423 from getnikola/fix-2422
Fix #2422
2 parents 89fb917 + 458df91 commit bc93e97

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Features
1111
Bugfixes
1212
--------
1313

14+
* Pass language to docutils so admonitions are translated (Issue #2422)
1415
* Put 2-file post metadata in the same place as the text file when
1516
specifying a path in ``new_post``, ``new_page`` (Issue #2420)
1617
* Register dependencies in post-list shortcode (Issue #2412)

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

+20-10
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@
4040
from docutils.parsers.rst import roles
4141

4242
from nikola.plugin_categories import PageCompiler
43-
from nikola.utils import unicode_str, get_logger, makedirs, write_metadata, STDERR_HANDLER
43+
from nikola.utils import (
44+
unicode_str,
45+
get_logger,
46+
makedirs,
47+
write_metadata,
48+
STDERR_HANDLER,
49+
LocaleBorg
50+
)
4451
from nikola.shortcodes import apply_shortcodes
4552

4653

@@ -63,16 +70,19 @@ def compile_html_string(self, data, source_path=None, is_two_file=True):
6370
add_ln = len(m_data.splitlines()) + 1
6471

6572
default_template_path = os.path.join(os.path.dirname(__file__), 'template.txt')
73+
settings_overrides = {
74+
'initial_header_level': 1,
75+
'record_dependencies': True,
76+
'stylesheet_path': None,
77+
'link_stylesheet': True,
78+
'syntax_highlight': 'short',
79+
'math_output': 'mathjax',
80+
'template': default_template_path,
81+
'language_code': LocaleBorg().current_lang,
82+
}
83+
6684
output, error_level, deps = rst2html(
67-
data, settings_overrides={
68-
'initial_header_level': 1,
69-
'record_dependencies': True,
70-
'stylesheet_path': None,
71-
'link_stylesheet': True,
72-
'syntax_highlight': 'short',
73-
'math_output': 'mathjax',
74-
'template': default_template_path,
75-
}, logger=self.logger, source_path=source_path, l_add_ln=add_ln, transforms=self.site.rst_transforms)
85+
data, settings_overrides=settings_overrides, logger=self.logger, source_path=source_path, l_add_ln=add_ln, transforms=self.site.rst_transforms)
7686
if not isinstance(output, unicode_str):
7787
# To prevent some weird bugs here or there.
7888
# Original issue: empty files. `output` became a bytestring.

0 commit comments

Comments
 (0)
Please sign in to comment.