]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/toc.pm
web commit by PatrickWinnertz
[ikiwiki.git] / IkiWiki / Plugin / toc.pm
index 063e66f3babafaa674bcd9a3d5ef472dfd2e4f20..bc62f71d6858cb302ef23549e5f63fe9152957e9 100644 (file)
@@ -4,14 +4,12 @@ package IkiWiki::Plugin::toc;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use HTML::Parser;
 
 sub import { #{{{
-       IkiWiki::hook(type => "preprocess", id => "toc",
-               call => \&preprocess);
-       IkiWiki::hook(type => "format", id => "toc",
-               call => \&format);
+       hook(type => "preprocess", id => "toc", call => \&preprocess);
+       hook(type => "format", id => "toc", call => \&format);
 } # }}}
 
 my %tocpages;
@@ -49,7 +47,7 @@ sub format (@) { #{{{
                if ($tagname =~ /^h(\d+)$/i) {
                        my $level=$1;
                        my $anchor="index".++$anchors{$level}."h$level";
-                       $page.="$text<a name=\"$anchor\" />";
+                       $page.="$text<a name=\"$anchor\"></a>";
        
                        # Take the first header level seen as the topmost level,
                        # even if there are higher levels seen later on.