Skip to content
Permalink
Browse files

Allowing compilers to specify additional targets.

  • Loading branch information
felixfontein committed Oct 25, 2016
1 parent 6470755 commit 9e80b59310cfb11cfdca654ddf01e1fd5cea94ab
Showing with 8 additions and 1 deletion.
  1. +2 −0 CHANGES.txt
  2. +4 −0 nikola/plugin_categories.py
  3. +2 −1 nikola/plugins/task/posts.py
@@ -10,6 +10,8 @@ Bugfixes
Features
--------

* Improving handling of .dep files, and allowing compilers to specify
additional targets for the render_posts task (Issue #2536)
* Allow posts to set custom ``URL_TYPE`` by using the ``url_type``
meta tag (useful for HTML fragments inserted using JavaScript)
* Plugins can depend on other plugins being installed (Issue #2533)
@@ -275,6 +275,10 @@ 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 get_extra_targets(self, post, lang, dest):
"""Returns a list of extra targets for the render_posts task when compiling the post for the specified language."""
return []

def compile(self, source, dest, is_two_file=True, post=None, lang=None):
"""Compile the source file into HTML and save as dest."""
# For backwards compatibility, call `compile_html`
@@ -86,11 +86,12 @@ def tl_ch():
dest = post.translated_base_path(lang)
dep_file = dest + '.dep'
file_dep = [p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")]
extra_targets = post.compiler.get_extra_targets(post, lang, dest)
task = {
'basename': self.name,
'name': dest,
'file_dep': file_dep,
'targets': [dest, dep_file],
'targets': [dest, dep_file] + extra_targets,
'actions': [(post.compile, (lang, )),
(update_deps, (post, lang, )),
],

0 comments on commit 9e80b59

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