X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/f65311bddb82133e51ab504220dac2b839a2b535..82d94d4d4a8768e4d741bd37fc3b805260f775b1:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index cc1e89acc..54e00ec7b 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1536,15 +1536,19 @@ sub run_hooks ($$) { my $sub=shift; if (exists $hooks{$type}) { - my @deferred; + my (@first, @middle, @last); foreach my $id (keys %{$hooks{$type}}) { - if ($hooks{$type}{$id}{last}) { - push @deferred, $id; - next; + if ($hooks{$type}{$id}{first}) { + push @first, $id; + } + elsif ($hooks{$type}{$id}{last}) { + push @last, $id; + } + else { + push @middle, $id; } - $sub->($hooks{$type}{$id}{call}); } - foreach my $id (@deferred) { + foreach my $id (@first, @middle, @last) { $sub->($hooks{$type}{$id}{call}); } }