aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn
diff options
context:
space:
mode:
authorharishcm <harishcm@web>2009-07-21 00:29:42 -0400
committerJoey Hess <joey@kitenet.net>2009-07-21 00:29:42 -0400
commit7d682ef4c2e5312f01c20cee67ccec491f8c6014 (patch)
tree9e740b58ae0a0639030c0e6770ac13ca4c520a6b /doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn
parent6463fe7a6bd0898f56a72bace0b69741634b49b7 (diff)
downloadikiwiki-7d682ef4c2e5312f01c20cee67ccec491f8c6014.tar
ikiwiki-7d682ef4c2e5312f01c20cee67ccec491f8c6014.tar.gz
patch overcoming the issue of <ul> with no <li>
Diffstat (limited to 'doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn')
-rw-r--r--doc/bugs/map_fails_to_close_ul_element_for_empty_list.mdwn27
1 files changed, 27 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\///