3 # Produce a hyerarchical map of links.
5 # By Alessandro Dotti Contra <alessandro@hyboria.org>
8 package IkiWiki::Plugin::map;
15 IkiWiki::hook(type => "preprocess", id => "map",
16 call => \&preprocess);
19 sub preprocess (@) { #{{{
21 $params{pages}="*" unless defined $params{pages};
23 # Needs to update whenever a page is added or removed, so
24 # register a dependency.
25 IkiWiki::add_depends($params{page}, $params{pages});
27 # Get all the items to map.
29 foreach my $page (keys %IkiWiki::links) {
30 if (IkiWiki::pagespec_match($page, $params{pages})) {
31 push @mapitems, $page;
37 my $map = "<div class='map'>\n";
38 foreach my $item (sort @mapitems) {
39 my $depth = ($item =~ tr/\//\//) + 1;
40 while ($depth < $indent) {
44 while ($depth > $indent) {
49 .IkiWiki::htmllink($params{page}, $params{destpage}, $item)