diff options
author | Simon McVittie <smcv@debian.org> | 2012-03-18 17:34:39 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2012-03-18 17:34:39 +0000 |
commit | 24168b993e65994d2996d02bfaa36fb80bb65ca7 (patch) | |
tree | 9a7480f1deb2222e4b80289bdc7e4697f084d06e /IkiWiki/Plugin/trail.pm | |
parent | 63bb8b42f76e350cdf7a1256ad0fe7ad63199f63 (diff) | |
download | ikiwiki-24168b993e65994d2996d02bfaa36fb80bb65ca7.tar ikiwiki-24168b993e65994d2996d02bfaa36fb80bb65ca7.tar.gz |
Add a build_affected hook so trail doesn't have to inject
In principle, building any pages affected by links, backlinks etc.
could work the same way.
Diffstat (limited to 'IkiWiki/Plugin/trail.pm')
-rw-r--r-- | IkiWiki/Plugin/trail.pm | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm index 4f309ea2e..29830175e 100644 --- a/IkiWiki/Plugin/trail.pm +++ b/IkiWiki/Plugin/trail.pm @@ -17,6 +17,7 @@ sub import { hook(type => "preprocess", id => "trailitems", call => \&preprocess_trailitems, scan => 1); hook(type => "preprocess", id => "traillink", call => \&preprocess_traillink, scan => 1); hook(type => "pagetemplate", id => "trail", call => \&pagetemplate); + hook(type => "build_affected", id => "trail", call => \&build_affected); } =head1 Page state @@ -275,14 +276,9 @@ sub trails_differ { my $done_prerender = 0; -my %origsubs; - sub prerender { return if $done_prerender; - $origsubs{render_backlinks} = \&IkiWiki::render_backlinks; - inject(name => "IkiWiki::render_backlinks", call => \&render_backlinks); - %trail_to_members = (); %member_to_trails = (); @@ -368,18 +364,14 @@ sub prerender { $done_prerender = 1; } -# This is called at about the right time that we can hijack it to render -# extra pages. -sub render_backlinks ($) { - my $blc = shift; +sub build_affected { + my %affected; foreach my $member (keys %rebuild_trail_members) { - next unless exists $pagesources{$member}; - - IkiWiki::render($pagesources{$member}, sprintf(gettext("building %s, its previous or next page has changed"), $member)); + $affected{$member} = sprintf(gettext("building %s, its previous or next page has changed"), $member); } - $origsubs{render_backlinks}($blc); + return %affected; } sub title_of ($) { |