summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-07-21 09:57:08 +0200
committerJoey Hess <joey@gnu.kitenet.net>2009-07-21 09:57:08 +0200
commiteeeda1295f08337f1321860d2b839732a46786e4 (patch)
tree0834588e062b7c167677c2366d5ffeaf89294811
parent4b1534d5bc969e05488a1f85f42208cbdf3da32e (diff)
parent4954ffb558d466f206a2ac8acbf47e251340b723 (diff)
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
-rw-r--r--doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn27
-rw-r--r--doc/plugins/map/discussion.mdwn3
2 files changed, 30 insertions, 0 deletions
diff --git a/doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn b/doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn
index 940e56cab..e565b8035 100644
--- a/doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn
+++ b/doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn
@@ -51,3 +51,30 @@ Patch:
>>> The patch in [[map/discussion|plugins/map/discussion]] has the same
>>> problem, but does suggest a simpler approach to solving it (bail out
>>> early if the map has no items at all). --[[smcv]]
+
+>>>> Thanks for pointing out the problem. I guess this patch should solve it.
+>>>> --[[harishcm]]
+
+Patch:
+
+ --- /usr/local/share/perl/5.8.8/IkiWiki/Plugin/map.pm
+ +++ map.pm
+ @@ -80,7 +80,17 @@
+ my $indent=0;
+ my $openli=0;
+ my $addparent="";
+ - my $map = "<div class='map'>\n<ul>\n";
+ + my $map = "<div class='map'>\n";
+ +
+ + # Return empty div if %mapitems is empty
+ + if (!scalar(keys %mapitems)) {
+ + $map .= "</div>\n";
+ + return $map;
+ + }
+ + else { # continue populating $map
+ + $map .= "<ul>\n";
+ + }
+ +
+ foreach my $item (sort keys %mapitems) {
+ my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
+ $item=~s/^\Q$common_prefix\E\///
diff --git a/doc/plugins/map/discussion.mdwn b/doc/plugins/map/discussion.mdwn
index 78f6802a7..2f7b140d6 100644
--- a/doc/plugins/map/discussion.mdwn
+++ b/doc/plugins/map/discussion.mdwn
@@ -44,3 +44,6 @@ that seems to work on the examples I tried. I am a beginner so please help me ou
> This was also reported as [[bugs/map_fails_to_close_ul_element_for_empty_list]];
> this patch is simpler than the one there, but has the same problem (it emits
> `<ul></ul>`, which technically isn't valid HTML either). --[[smcv]]
+
+>> Thanks for the tip, I added another patch addressing the issue at
+>> [[bugs/map_fails_to_close_ul_element_for_empty_list]]. --[[harishcm]]