1 [[!tag plugins/map patch]]
6 \[[!map pages="sdfsdfsdfsd/*"]]
9 Presuming that the pagespec does not match, output:
16 The UL element is not closed.
20 --- /usr/share/perl5/IkiWiki/Plugin/map.pm 2009-05-06 00:56:55.000000000 +0100
21 +++ IkiWiki/Plugin/map.pm 2009-06-15 12:23:54.000000000 +0100
26 - while ($indent > 0) {
27 + while ($indent > 1) {
29 $map .= "</li>\n</ul>\n";
32 + $map .= "</ul>\n</div>\n";
39 > Strictly speaking, a `<ul>` with no `<li>`s isn't valid HTML either...
40 > could `map` instead delay emitting the first `<ul>` until it determines that
41 > it will have at least one item? Perhaps refactoring that function into
42 > something easier to regression-test would be useful. --[[smcv]]
44 >> You are right (just checked 4.01 DTD to confirm). I suspect refactoring
45 >> the function would be wise. From my brief look at it to formulate the
46 >> above I thought it was a bit icky. I'm not a good judge of what would
47 >> be regression-test friendly but I might have a go at reworking it. With
48 >> this variety of problem I have a strong inclination to use HOFs like map,
51 >>> The patch in [[map/discussion|plugins/map/discussion]] has the same
52 >>> problem, but does suggest a simpler approach to solving it (bail out
53 >>> early if the map has no items at all). --[[smcv]]
55 >>>> Thanks for pointing out the problem. I guess this patch should solve it.
58 >>>>> Well, I suppose that's certainly a minimal patch for this bug :-)
59 >>>>> I'm not the IkiWiki maintainer, but if I was, I'd apply it, so I've put
60 >>>>> it in a git branch for Joey's convenience. Joey, Jon: any opinion?
62 >>>>> If you want to be credited for this patch under a name other than
63 >>>>> "harishcm" (e.g. your real name), let me know and I'll amend the branch.
64 >>>>> (Or, make a git branch of your own and replace the reference just below,
65 >>>>> if you prefer.) --[[smcv]]
67 >>>>>> The current arrangement looks fine to me. Thanks. --[[harishcm]]
69 [[!template id=gitbranch author="[[harishcm]]" branch=smcv/ready/harishcm-map-fix]]
71 > [[merged|done]] --[[Joey]]
75 --- /usr/local/share/perl/5.8.8/IkiWiki/Plugin/map.pm
81 - my $map = "<div class='map'>\n<ul>\n";
82 + my $map = "<div class='map'>\n";
84 + # Return empty div if %mapitems is empty
85 + if (!scalar(keys %mapitems)) {
89 + else { # continue populating $map
93 foreach my $item (sort keys %mapitems) {
94 my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
95 $item=~s/^\Q$common_prefix\E\///