From: Simon McVittie <smcv@debian.org>
Date: Wed, 2 Jan 2013 17:36:17 +0000 (+0000)
Subject: trail: call prerender from build_affected
X-Git-Tag: 3.20130212~33^2~3
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/1daa68b8b7a496736cc27f80c1de2bd4d97d5225?ds=inline;hp=-c

trail: call prerender from build_affected

In the unlikely event that the ordered contents of a trail have changed
without the TRAILS or TRAILLOOP template variables being evaluated
(for instance, all trail directives are removed from a former trail
that uses a custom pagetemplate that doesn't contain TRAILS), we might
get here without having already called prerender.
---

1daa68b8b7a496736cc27f80c1de2bd4d97d5225
diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm
index cf0f0a15e..86c94642a 100644
--- a/IkiWiki/Plugin/trail.pm
+++ b/IkiWiki/Plugin/trail.pm
@@ -359,6 +359,12 @@ sub prerender {
 sub build_affected {
 	my %affected;
 
+	# In principle we might not have done this yet, although in practice
+	# at least the trail itself has probably changed, and its template
+	# almost certainly contains TRAILS or TRAILLOOP, triggering our
+	# prerender as a side-effect.
+	prerender();
+
 	foreach my $member (keys %rebuild_trail_members) {
 		$affected{$member} = sprintf(gettext("building %s, its previous or next page has changed"), $member);
 	}