Skip to content
Permalink
Browse files

Merge pull request #2423 from getnikola/fix-2422

Fix #2422
  • Loading branch information
ralsina committed Aug 2, 2016
2 parents 89fb917 + 458df91 commit bc93e973031f82978fb417e737bb9d19aa8167fd
Showing with 21 additions and 10 deletions.
  1. +1 −0 CHANGES.txt
  2. +20 −10 nikola/plugins/compile/rest/__init__.py
@@ -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)
@@ -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


@@ -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.

0 comments on commit bc93e97

Please sign in to comment.