]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
* More compact output for the brokenlinks plugin.
authorJoey Hess <joey@kodama.kitenet.net>
Sat, 17 Nov 2007 21:16:34 +0000 (16:16 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Sat, 17 Nov 2007 21:16:34 +0000 (16:16 -0500)
IkiWiki/Plugin/brokenlinks.pm
debian/changelog
doc/todo/brokenlinks_should_group_links_to_a_page.mdwn
po/ikiwiki.pot

index a4da7161e22d8707664b41484839087933893b93..ef5837a5876c44b1082a3556d5cabe75cd24c7ef 100644 (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
index cf7063f40b4c76d130ba255f8db0cd87eb4c1e5b..c8a9fbdbcb3172a6f179f38ea34b5a93094ae7f4 100644 (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
 
index 3f2c14404158e85d363890cd50e0afa8ddc4b460..8d7c9eb7acda8c701ac5ca13d2f3a4c1febc012f 100644 (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]]
index c20db1ac41bc08508faf7eaac073849336a5caf1..b1842d5461a81581c0c8c1b45e7bebe354f3bfb4 100644 (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 ""