Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #2451
  • Loading branch information
ralsina committed Aug 18, 2016
1 parent c7106a3 commit 6e16593
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -14,6 +14,7 @@ Features
Bugfixes
--------

* Record template dependencies for post-list shortcut (Issue #2451)
* Default to English for docutils messages if no translations exist
(Issues #2422, #2437)

Expand Down
15 changes: 9 additions & 6 deletions nikola/plugins/compile/rest/post_list.py
Expand Up @@ -172,9 +172,11 @@ def run(self):
sort = self.options.get('sort')
date = self.options.get('date')

output = _do_post_list(start, stop, reverse, tags, categories, sections, slugs, post_type, type,
output, deps = _do_post_list(start, stop, reverse, tags, categories, sections, slugs, post_type, type,
all, lang, template, sort, state=self.state, site=self.site, date=date)
self.state.document.settings.record_dependencies.add("####MAGIC####TIMELINE")
for d in deps:
self.state.document.settings.record_dependencies.add(d)
if output:
return [nodes.raw('', output, format='html')]
else:
Expand Down Expand Up @@ -284,13 +286,14 @@ def _do_post_list(start=None, stop=None, reverse=False, tags=None, categories=No
if not posts:
return ''

template_deps = site.template_system.template_deps(template)
if state:
# Register template as a dependency (Issue #2391)
state.document.settings.record_dependencies.add(
site.template_system.get_template_path(template))
for d in template_deps:
state.document.settings.record_dependencies.add(d)
elif self_post:
self_post.register_depfile(
site.template_system.get_template_path(template), lang=lang)
for d in template_deps:
self_post.register_depfile(d, lang=lang)

template_data = {
'lang': lang,
Expand All @@ -302,7 +305,7 @@ def _do_post_list(start=None, stop=None, reverse=False, tags=None, categories=No
}
output = site.template_system.render_template(
template, None, template_data)
return output
return output, template_deps

# Request file name from shortcode (Issue #2412)
_do_post_list.nikola_shortcode_pass_filename = True

0 comments on commit 6e16593

Please sign in to comment.