From c9c0f271b60e4a6ef8392cd3a5339d9c2368b494 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Nov 2007 11:40:02 -0500 Subject: [PATCH] * toc: Handle html elements embedded inside a header, rather than stopping collecting the header text at the first element. --- IkiWiki/Plugin/toc.pm | 22 +++++++++++++++------- debian/changelog | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index 070c07b0e..639cae4a9 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -86,17 +86,25 @@ sub format (@) { #{{{ } $liststarted=0; } + + $index.=&$indent."\n" unless $liststarted; + $liststarted=0; + $index.=&$indent."
  • ". + ""; $p->handler(text => sub { $page.=join("", @_); - $index.=&$indent."
  • \n" unless $liststarted; - $liststarted=0; - $index.=&$indent."
  • ". - "". - join("", @_). - "\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.="\n"; + } + $page.=join("", @_); + }, "tagname, text"); } else { $page.=$text; diff --git a/debian/changelog b/debian/changelog index 4ee2f7c80..5fddab963 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sat, 17 Nov 2007 19:56:46 -0500 -- 2.26.2