X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=blobdiff_plain;f=IkiWiki%2FPlugin%2Fmap.pm;h=826dbbd66ba68dee4401b259c2d3b87ae7e5d1ea;hp=328493116e42e29125aca0353062886588e38e5f;hb=786b78be46571234c741664d175cc4b0c8fea60e;hpb=1ca191b5707ef38af5cbe196e314d57cd5c8c065 diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 328493116..826dbbd66 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -32,32 +32,31 @@ sub preprocess (@) { # Get all the items to map. my %mapitems; - foreach my $page (keys %pagesources) { - if (pagespec_match($page, $params{pages}, location => $params{page})) { - if (exists $params{show} && - exists $pagestate{$page} && - exists $pagestate{$page}{meta}{$params{show}}) { - $mapitems{$page}=$pagestate{$page}{meta}{$params{show}}; - } - else { - $mapitems{$page}=''; - } - # Check for a common prefix. - if (! defined $common_prefix) { - $common_prefix=$page; - } - elsif (length $common_prefix && - $page !~ /^\Q$common_prefix\E(\/|$)/) { - my @a=split(/\//, $page); - my @b=split(/\//, $common_prefix); - $common_prefix=""; - while (@a && @b && $a[0] eq $b[0]) { - if (length $common_prefix) { - $common_prefix.="/"; - } - $common_prefix.=shift(@a); - shift @b; + foreach my $page (pagespec_match_list([keys %pagesources], + $params{pages}, location => $params{page})) { + if (exists $params{show} && + exists $pagestate{$page} && + exists $pagestate{$page}{meta}{$params{show}}) { + $mapitems{$page}=$pagestate{$page}{meta}{$params{show}}; + } + else { + $mapitems{$page}=''; + } + # Check for a common prefix. + if (! defined $common_prefix) { + $common_prefix=$page; + } + elsif (length $common_prefix && + $page !~ /^\Q$common_prefix\E(\/|$)/) { + my @a=split(/\//, $page); + my @b=split(/\//, $common_prefix); + $common_prefix=""; + while (@a && @b && $a[0] eq $b[0]) { + if (length $common_prefix) { + $common_prefix.="/"; } + $common_prefix.=shift(@a); + shift @b; } } } @@ -81,7 +80,17 @@ sub preprocess (@) { my $indent=0; my $openli=0; my $addparent=""; - my $map = "
\n