Skip to content

Commit

Permalink
Merge pull request #2423 from getnikola/fix-2422
Browse files Browse the repository at this point in the history
Fix #2422
  • Loading branch information
ralsina committed Aug 2, 2016
2 parents 89fb917 + 458df91 commit bc93e97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -11,6 +11,7 @@ Features
Bugfixes
--------

* Pass language to docutils so admonitions are translated (Issue #2422)
* Put 2-file post metadata in the same place as the text file when
specifying a path in ``new_post``, ``new_page`` (Issue #2420)
* Register dependencies in post-list shortcode (Issue #2412)
Expand Down
30 changes: 20 additions & 10 deletions nikola/plugins/compile/rest/__init__.py
Expand Up @@ -40,7 +40,14 @@
from docutils.parsers.rst import roles

from nikola.plugin_categories import PageCompiler
from nikola.utils import unicode_str, get_logger, makedirs, write_metadata, STDERR_HANDLER
from nikola.utils import (
unicode_str,
get_logger,
makedirs,
write_metadata,
STDERR_HANDLER,
LocaleBorg
)
from nikola.shortcodes import apply_shortcodes


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

default_template_path = os.path.join(os.path.dirname(__file__), 'template.txt')
settings_overrides = {
'initial_header_level': 1,
'record_dependencies': True,
'stylesheet_path': None,
'link_stylesheet': True,
'syntax_highlight': 'short',
'math_output': 'mathjax',
'template': default_template_path,
'language_code': LocaleBorg().current_lang,
}

output, error_level, deps = rst2html(
data, settings_overrides={
'initial_header_level': 1,
'record_dependencies': True,
'stylesheet_path': None,
'link_stylesheet': True,
'syntax_highlight': 'short',
'math_output': 'mathjax',
'template': default_template_path,
}, logger=self.logger, source_path=source_path, l_add_ln=add_ln, transforms=self.site.rst_transforms)
data, settings_overrides=settings_overrides, logger=self.logger, source_path=source_path, l_add_ln=add_ln, transforms=self.site.rst_transforms)
if not isinstance(output, unicode_str):
# To prevent some weird bugs here or there.
# Original issue: empty files. `output` became a bytestring.
Expand Down

0 comments on commit bc93e97

Please sign in to comment.