From 8041475aab2b8efad7d2857027331bd626d26312 Mon Sep 17 00:00:00 2001 From: Agustin Henze Date: Wed, 26 Aug 2015 07:57:04 -0300 Subject: Imported Upstream version 7.6.4 --- nikola/plugins/task/posts.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'nikola/plugins/task/posts.py') diff --git a/nikola/plugins/task/posts.py b/nikola/plugins/task/posts.py index d3f17fd..a3a8375 100644 --- a/nikola/plugins/task/posts.py +++ b/nikola/plugins/task/posts.py @@ -24,6 +24,8 @@ # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +"""Build HTML fragments from metadata and text.""" + from copy import copy import os @@ -32,7 +34,7 @@ from nikola import filters, utils def update_deps(post, lang, task): - """Updates file dependencies as they might have been updated during compilation. + """Update file dependencies as they might have been updated during compilation. This is done for example by the ReST page compiler, which writes its dependencies into a .dep file. This file is read and incorporated when calling @@ -42,6 +44,7 @@ def update_deps(post, lang, task): class RenderPosts(Task): + """Build HTML fragments from metadata and text.""" name = "render_posts" @@ -74,7 +77,11 @@ class RenderPosts(Task): deps_dict = copy(kw) deps_dict.pop('timeline') for post in kw['timeline']: - + # Extra config dependencies picked from config + for p in post.fragment_deps(lang): + if p.startswith('####MAGIC####CONFIG:'): + k = p.split('####MAGIC####CONFIG:', 1)[-1] + deps_dict[k] = self.site.config.get(k) dest = post.translated_base_path(lang) file_dep = [p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")] task = { @@ -110,6 +117,7 @@ class RenderPosts(Task): yield utils.apply_filters(task, {os.path.splitext(dest): flist}) def dependence_on_timeline(self, post, lang): + """Check if a post depends on the timeline.""" if "####MAGIC####TIMELINE" not in post.fragment_deps(lang): return True # No dependency on timeline elif self.tl_changed: -- cgit v1.2.3