* More compact output for the brokenlinks plugin.

master
Joey Hess 2007-11-17 16:16:34 -05:00
parent 6d7202a014
commit 6ccd9313d2
4 changed files with 27 additions and 11 deletions

View File

@ -18,7 +18,7 @@ sub preprocess (@) { #{{{
# register a dependency.
add_depends($params{page}, $params{pages});
my @broken;
my %broken;
foreach my $page (keys %links) {
if (pagespec_match($page, $params{pages}, location => $params{page})) {
my $discussion=gettext("discussion");
@ -26,16 +26,29 @@ sub preprocess (@) { #{{{
next if $link =~ /.*\/\Q$discussion\E/i && $config{discussion};
my $bestlink=bestlink($page, $link);
next if length $bestlink;
push @broken, sprintf(gettext("%s from %s"),
htmllink($page, $params{destpage}, $link, noimageinline => 1),
htmllink($params{page}, $params{destpage}, $page, noimageinline => 1));
push @{$broken{$link}}, $page;
}
}
}
my @broken;
foreach my $link (keys %broken) {
my $page=$broken{$link}->[0];
push @broken, sprintf(gettext("%s from %s"),
htmllink($page, $params{destpage}, $link, noimageinline => 1),
join(", ", map {
htmllink($params{page}, $params{destpage}, $_, noimageinline => 1)
} @{$broken{$link}}));
}
return gettext("There are no broken links!") unless @broken;
my %seen;
return "<ul>\n".join("\n", map { "<li>$_</li>" } grep { ! $seen{$_}++ } sort @broken)."</ul>\n";
return gettext("There are no broken links!") unless %broken;
return "<ul>\n"
.join("\n",
map {
"<li>$_</li>"
}
sort @broken)
."</ul>\n";
} # }}}
1

3
debian/changelog vendored
View File

@ -16,8 +16,9 @@ ikiwiki (2.13) UNRELEASED; urgency=low
* Better error message when a setup file has a syntax error.
Closes: #451666
* Fix mercurial historyurl in example setup file.
* More compact output for the brokenlinks plugin.
-- Joey Hess <joeyh@debian.org> Sat, 17 Nov 2007 14:43:26 -0500
-- Joey Hess <joeyh@debian.org> Sat, 17 Nov 2007 15:59:54 -0500
ikiwiki (2.12) unstable; urgency=low

View File

@ -17,3 +17,5 @@ target.
> that the user both won't take much care which link is clicked on
> to create it, and that both pages really meant to link to the same page
> anyway. --[[Joey]]
[[done]]

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-11-14 09:23-0500\n"
"POT-Creation-Date: 2007-11-17 16:11-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -127,12 +127,12 @@ msgstr ""
msgid "creating new page %s"
msgstr ""
#: ../IkiWiki/Plugin/brokenlinks.pm:29
#: ../IkiWiki/Plugin/brokenlinks.pm:37
#, perl-format
msgid "%s from %s"
msgstr ""
#: ../IkiWiki/Plugin/brokenlinks.pm:36
#: ../IkiWiki/Plugin/brokenlinks.pm:44
msgid "There are no broken links!"
msgstr ""