* The toc directive doesn't work well or make sense inside an inlined page.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 11 Aug 2007 21:46:59 +0000 (21:46 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 11 Aug 2007 21:46:59 +0000 (21:46 +0000)
  Disable it when the page with the toc is nested inside another page.

IkiWiki/Plugin/toc.pm
debian/changelog

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 (@) { #{{{
index dbab896bd754c7d29ddae04d03cf8c85ca91abdd..f3afac0138afeef3667185e0c210ee9639b3d4bf 100644 (file)
@@ -13,8 +13,10 @@ ikiwiki (2.6) UNRELEASED; urgency=low
   * Move blog form code out of CGI.pm and into the inline plugin.
   * Updated Spanish translation from Victor Moral.
   * Updated French translation from Cyril Brulebois. Closes: #437181
+  * 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.
 
- -- Joey Hess <joeyh@debian.org>  Sat, 11 Aug 2007 17:24:46 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat, 11 Aug 2007 17:40:45 -0400
 
 ikiwiki (2.5) unstable; urgency=low