X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/2eac55e90efa6aa82f3159385f1398be4b3bf6da..56d0ceee2e9e324d78ed88d60d7bce108a0b32dd:/IkiWiki/Plugin/map.pm diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index c65e61ac9..0ae5c1002 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -2,9 +2,9 @@ # # Produce a hyerarchical map of links. # -# By Alessandro Dotti Contra +# by Alessandro Dotti Contra # -# Revision: 0.1 +# Revision: 0.2 package IkiWiki::Plugin::map; use warnings; @@ -34,26 +34,30 @@ sub preprocess (@) { #{{{ # Create the map. my $indent=0; + my $openli=0; my $map = "
\n"; + $map .= "
    \n"; foreach my $item (sort @mapitems) { - my $depth = ($item =~ tr/\//\//) + 1; - next if exists $params{maxdepth} && $depth > $params{maxdepth}; + my $depth = ($item =~ tr/\//\//); while ($depth < $indent) { $indent--; - $map.="
\n"; + $map.="\n"; } while ($depth > $indent) { $indent++; $map.="
    \n"; + $openli=0; } + $map .= "\n" if $openli; $map .= "
  • " - .IkiWiki::htmllink($params{page}, $params{destpage}, $item) - ."
  • \n"; + .IkiWiki::htmllink($params{page}, $params{destpage}, $item) ."\n"; + $openli=1; } while ($indent > 0) { $indent--; - $map.="
\n"; + $map.="\n"; } + $map .= "\n"; $map .= "
\n"; return $map; } # }}}