From: Joey Hess Date: Fri, 14 Aug 2009 04:51:52 +0000 (-0400) Subject: orphans: Reuse backlinks info X-Git-Tag: 3.1415926~132 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f486271009142ec7e04e1a62c1e94ad9e51b6d39;p=ikiwiki.git orphans: Reuse backlinks info This plugin was building essentially the same data that is built to handle backlinks, so reuse that as an optimisation. --- diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 02f5d2524..711226772 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -27,15 +27,9 @@ sub preprocess (@) { # register a dependency. add_depends($params{page}, $params{pages}); - my %linkedto; - foreach my $p (keys %links) { - map { $linkedto{bestlink($p, $_)}=1 if length $_ } - @{$links{$p}}; - } - my @orphans; foreach my $page (pagespec_match_list( - [ grep { ! $linkedto{$_} && $_ ne 'index' } + [ grep { ! IkiWiki::backlink_pages($_) && $_ ne 'index' } keys %pagesources ], $params{pages}, location => $params{page})) { # If the page has a link to some other page, it's