X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ee1ad53c4c2710aa7ded61bdc56f3a8cce514f22..ef43bff1ca455cf9608d463408598924220cb4e3:/IkiWiki/Plugin/toc.pm diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index 797bfc6bd..070c07b0e 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -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
\n"; + return "\n
\n"; + } + else { + # Don't generate toc in an inlined page, doesn't work + # right. + return ""; + } } # }}} sub format (@) { #{{{ @@ -47,7 +54,7 @@ sub format (@) { #{{{ if ($tagname =~ /^h(\d+)$/i) { my $level=$1; my $anchor="index".++$anchors{$level}."h$level"; - $page.="$text"; + $page.="$text"; # Take the first header level seen as the topmost level, # even if there are higher levels seen later on.