* toc: Handle html elements embedded inside a header, rather than
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 23 Nov 2007 16:40:02 +0000 (11:40 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 23 Nov 2007 16:40:02 +0000 (11:40 -0500)
  stopping collecting the header text at the first element.

IkiWiki/Plugin/toc.pm
debian/changelog

index 070c07b0e96093b4c82c3bb9e6c8751dcb7ed414..639cae4a90e88d437824f51689824fa1b30e95ca 100644 (file)
@@ -86,17 +86,25 @@ sub format (@) { #{{{
                                }
                                $liststarted=0;
                        }
+                               
+                       $index.=&$indent."</li>\n" unless $liststarted;
+                       $liststarted=0;
+                       $index.=&$indent."<li class=\"L$curlevel\">".
+                               "<a href=\"#$anchor\">";
        
                        $p->handler(text => sub {
                                $page.=join("", @_);
-                               $index.=&$indent."</li>\n" unless $liststarted;
-                               $liststarted=0;
-                               $index.=&$indent."<li class=\"L$curlevel\">".
-                                       "<a href=\"#$anchor\">".
-                                       join("", @_).
-                                       "</a>\n";
-                               $p->handler(text => undef);
+                               $index.=join("", @_);
                        }, "dtext");
+                       $p->handler(end => sub {
+                               my $tagname=shift;
+                               if ($tagname =~ /^h(\d+)$/i) {
+                                       $p->handler(text => undef);
+                                       $p->handler(end => undef);
+                                       $index.="</a>\n";
+                               }
+                               $page.=join("", @_);
+                       }, "tagname, text");
                }
                else {
                        $page.=$text;
index 4ee2f7c80801c2f2813c7127639cca6fdb93a7ec..5fddab9638cc14c806146c11f538e50856d99701 100644 (file)
@@ -24,6 +24,8 @@ ikiwiki (2.13) UNRELEASED; urgency=low
     directories, to improve browsing of file:// urls.
     Patch by Daniel Burrows. Closes: #451728
   * Allow html5 video and audio tags and their attributes in the htmlscrubber.
+  * toc: Handle html elements embedded inside a header, rather than
+    stopping collecting the header text at the first element.
 
  -- Joey Hess <joeyh@debian.org>  Sat, 17 Nov 2007 19:56:46 -0500