X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4e54fa1144065b7ff99e88e6c61ff1fdcf6175c9..914c362197597278bf077a263da0e5cb5021fc6b:/IkiWiki/Plugin/trail.pm diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm index 5ee152155..29830175e 100644 --- a/IkiWiki/Plugin/trail.pm +++ b/IkiWiki/Plugin/trail.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl # Copyright © 2008-2011 Joey Hess -# Copyright © 2009-2011 Simon McVittie +# Copyright © 2009-2012 Simon McVittie # Licensed under the GNU GPL, version 2, or any later version published by the # Free Software Foundation package IkiWiki::Plugin::trail; @@ -13,11 +13,11 @@ sub import { hook(type => "getsetup", id => "trail", call => \&getsetup); hook(type => "needsbuild", id => "trail", call => \&needsbuild); hook(type => "preprocess", id => "trailoptions", call => \&preprocess_trailoptions, scan => 1); - hook(type => "preprocess", id => "trailinline", call => \&preprocess_trailinline, scan => 1); hook(type => "preprocess", id => "trailitem", call => \&preprocess_trailitem, scan => 1); 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 @@ -123,29 +123,6 @@ sub preprocess_trailoptions (@) { return ""; } -sub preprocess_trailinline (@) { - my %params = @_; - - if (! exists $params{sort}) { - # sort in the same order as [[plugins/inline]]'s default - $params{sort} = 'age'; - } - - if (defined wantarray) { - scalar preprocess_trailitems(%params); - - if (IkiWiki->can("preprocess_inline")) { - return IkiWiki::preprocess_inline(@_); - } - else { - error("trailinline directive requires the inline plugin"); - } - } - else { - preprocess_trailitems(%params); - } -} - sub preprocess_trailitem (@) { my $link = shift; shift; @@ -299,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 = (); @@ -392,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 ($) {