diff options
author | harishcm <harishcm@web> | 2009-07-25 20:16:11 +0100 |
---|---|---|
committer | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2009-07-25 20:16:11 +0100 |
commit | 786b78be46571234c741664d175cc4b0c8fea60e (patch) | |
tree | 1f8778083c076c99ed5d5b3569ae31b0ae26bb45 /IkiWiki | |
parent | f237ea1b9a78bb85f26cbbead34e734e3f3fb198 (diff) | |
download | ikiwiki-786b78be46571234c741664d175cc4b0c8fea60e.tar ikiwiki-786b78be46571234c741664d175cc4b0c8fea60e.tar.gz |
Fix failure to close <ul> in maps with no items
Signed-off-by: Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/map.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 120451b5d..826dbbd66 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -80,7 +80,17 @@ sub preprocess (@) { 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\/// |