]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/toc.pm
web commit by PatrickWinnertz: since revert isn't possible via web, I 'reverted'...
[ikiwiki.git] / IkiWiki / Plugin / toc.pm
index bc62f71d6858cb302ef23549e5f63fe9152957e9..070c07b0e96093b4c82c3bb9e6c8751dcb7ed414 100644 (file)
@@ -17,13 +17,20 @@ my %tocpages;
 sub preprocess (@) { #{{{
        my %params=@_;
 
-       $params{levels}=1 unless exists $params{levels};
+       if ($params{page} eq $params{destpage}) {
+               $params{levels}=1 unless exists $params{levels};
 
-       # It's too early to generate the toc here, so just record the
-       # info.
-       $tocpages{$params{destpage}}=\%params;
+               # It's too early to generate the toc here, so just record the
+               # info.
+               $tocpages{$params{destpage}}=\%params;
 
-       return "\n<div class=\"toc\"></div>\n";
+               return "\n<div class=\"toc\"></div>\n";
+       }
+       else {
+               # Don't generate toc in an inlined page, doesn't work
+               # right.
+               return "";
+       }
 } # }}}
 
 sub format (@) { #{{{