summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/toc.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-11 21:46:59 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-11 21:46:59 +0000
commitdc89360f03796465df96093b5a18a4abd661b4a3 (patch)
tree96a132e81fac5bae979eae9dd278a2ab1518d8fc /IkiWiki/Plugin/toc.pm
parent3ef2f4b529454dbb2a045686a763be7e3cd27801 (diff)
* The toc directive doesn't work well or make sense inside an inlined page.
Disable it when the page with the toc is nested inside another page.
Diffstat (limited to 'IkiWiki/Plugin/toc.pm')
-rw-r--r--IkiWiki/Plugin/toc.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm
index bc62f71d6..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<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 (@) { #{{{