Skip to content
Permalink
Browse files

fix #1688

  • Loading branch information
ralsina committed May 12, 2015
1 parent fa27ee5 commit ebebae781278b7f210d9f9e84de76ed8b3440d23
Showing with 24 additions and 7 deletions.
  1. +1 −0 CHANGES.txt
  2. +23 −7 nikola/plugins/task/posts.py
@@ -7,6 +7,7 @@ Features
Bugfixes
--------

* Timeline checksum for whole-timeline dependencies (Issue #1688)
* new_post paths are now relative to CWD (Issue #1325)

New in v7.4.1
@@ -30,7 +30,7 @@
from nikola import utils


def update_deps(post, lang, task):
def update_deps(post, lang, deps_dict, timeline, task):
"""Updates file dependencies as they might have been updated during compilation.
This is done for example by the ReST page compiler, which writes its
@@ -40,10 +40,6 @@ def update_deps(post, lang, task):
task.file_dep.update([p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")])


def dependence_on_timeline(post, lang):
return "####MAGIC####TIMELINE" not in post.fragment_deps(lang)


class RenderPosts(Task):
"""Build HTML fragments from metadata and text."""

@@ -59,13 +55,25 @@ def gen_tasks(self):
"show_untranslated_posts": self.site.config['SHOW_UNTRANSLATED_POSTS'],
"demote_headers": self.site.config['DEMOTE_HEADERS'],
}
self.tl_changed = False

yield self.group_task()

def tl_ch():
self.tl_changed = True

yield {
'basename': self.name,
'name': 'timeline_changes',
'actions': [tl_ch],
'uptodate': [utils.config_changed(str(kw['timeline']))],
}

for lang in kw["translations"]:
deps_dict = copy(kw)
deps_dict.pop('timeline')
for post in kw['timeline']:

dest = post.translated_base_path(lang)
file_dep = [p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")]
task = {
@@ -74,12 +82,20 @@ def gen_tasks(self):
'file_dep': file_dep,
'targets': [dest],
'actions': [(post.compile, (lang, )),
(update_deps, (post, lang, )),
(update_deps, (post, lang, deps_dict, kw['timeline'], )),
],
'clean': True,
'uptodate': [
utils.config_changed(deps_dict, 'nikola.plugins.task.posts'),
lambda p=post, l=lang: dependence_on_timeline(p, l)
lambda p=post, l=lang: self.dependence_on_timeline(p, l)
] + post.fragment_deps_uptodate(lang),
'task_dep': ['render_posts:timeline_changes']
}
yield task

def dependence_on_timeline(self, post, lang):
if "####MAGIC####TIMELINE" not in post.fragment_deps(lang):
return True # No dependency on timeline
elif self.tl_changed:
return False # Timeline changed
return True

0 comments on commit ebebae7

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