use strict;
use IkiWiki 2.00;
-sub import { #{{{
+sub import {
+ hook(type => "getsetup", id => "brokenlinks", call => \&getsetup);
hook(type => "preprocess", id => "brokenlinks", call => \&preprocess);
-} # }}}
+}
-sub preprocess (@) { #{{{
+sub getsetup {
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+}
+
+sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
foreach my $page (keys %links) {
if (pagespec_match($page, $params{pages}, location => $params{page})) {
my $discussion=gettext("discussion");
+ my %seen;
foreach my $link (@{$links{$page}}) {
+ next if $seen{$link};
+ $seen{$link}=1;
next if $link =~ /.*\/\Q$discussion\E/i && $config{discussion};
my $bestlink=bestlink($page, $link);
next if length $bestlink;
}
sort @broken)
."</ul>\n";
-} # }}}
+}
1