Skip to content
Permalink
Browse files

Fix #2531 — pass post and lang to compilers

  • Loading branch information
Kwpolska committed Oct 14, 2016
1 parent 660f7fa commit 74fa2f419b0e04aa7edd9810bab9a9dfa2b8ed73
Showing with 24 additions and 3 deletions.
  1. +11 −0 CHANGES.txt
  2. +9 −1 nikola/plugin_categories.py
  3. +4 −2 nikola/post.py
@@ -1,3 +1,14 @@
New in master
=============

Bugfixes
--------

Features
--------

* Pass ``post`` object and ``lang`` to post compilers (Issue #2531)

New in v7.8.1
=============

@@ -275,8 +275,16 @@ def register_extra_dependencies(self, post):
"""Add dependency to post object to check .dep file."""
post.add_dependency(lambda: self._read_extra_deps(post), 'fragment')

def compile(self, source, dest, is_two_file=False, post=None, lang=None):
"""Compile the source file and save it to dest."""
# For backwards compatibility, call `compile_html`
# If you are implementing a compiler, please implement `compile` and
# ignore `compile_html`
self.compile_html(source, dest, is_two_file)

# TODO remove in v8
def compile_html(self, source, dest, is_two_file=False):
"""Compile the source, save it on dest."""
"""Compile the source, save it on dest. (DEPRECATED)"""
raise NotImplementedError()

def create_post(self, path, content=None, onefile=False, is_page=False, **kw):
@@ -97,7 +97,9 @@ def __init__(
"""
self.config = config
self.compiler = compiler
self.compile_html = self.compiler.compile_html
self.compile = self.compiler.compile
# TODO remove in v8
self.compile_html = self.compile
self.demote_headers = self.compiler.demote_headers and self.config['DEMOTE_HEADERS']
tzinfo = self.config['__tzinfo__']
if self.config['FUTURE_IS_NOW']:
@@ -516,7 +518,7 @@ def wrap_encrypt(path, password):
return
# Set the language to the right thing
LocaleBorg().set_locale(lang)
self.compile_html(
self.compile(
self.translated_source_path(lang),
dest,
self.is_two_file)

0 comments on commit 74fa2f4

Please sign in to comment.
You can’t perform that action at this time.