2 # Provides a list of broken links.
3 package IkiWiki
::Plugin
::brokenlinks
;
10 hook
(type
=> "getsetup", id
=> "brokenlinks", call
=> \
&getsetup
);
11 hook
(type
=> "preprocess", id
=> "brokenlinks", call
=> \
&preprocess
);
24 $params{pages
}="*" unless defined $params{pages
};
27 foreach my $link (keys %IkiWiki::brokenlinks
) {
28 next if $link =~ /.*\/\Q
$config{discussionpage
}\E
/i
&& $config{discussion
};
30 my @pages=pagespec_match_list
($params{page
}, $params{pages
},
31 list
=> $IkiWiki::brokenlinks
{$link},
32 # needs to update when links on a page change
33 deptype
=> deptype
("links")
37 my $page=$IkiWiki::brokenlinks
{$link}->[0];
38 push @broken, sprintf(gettext
("%s from %s"),
39 htmllink
($page, $params{destpage
}, $link, noimageinline
=> 1),
41 htmllink
($params{page
}, $params{destpage
}, $_, noimageinline
=> 1)
46 return gettext
("There are no broken links!") unless @broken;