summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-04-26 15:13:01 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-04-26 15:13:01 -0400
commit9652cdfe2eb16150518e34af33c8858118fe0a09 (patch)
tree245dc76c0809d2c53f6114558c7e3c9b06ddb4e7
parent2d78c4d9a70f93d97047fa414c8fb5fa693712dd (diff)
toc: Add the table of contents at sanitize time, rather than at format time. This allows the toc to be displayed when previewing an edit. It also avoids headers in the page template from showing up in the toc.
-rw-r--r--IkiWiki/Plugin/toc.pm4
-rw-r--r--debian/changelog8
-rw-r--r--doc/plugins/toc/discussion.mdwn2
3 files changed, 12 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm
index 639cae4a9..5380dd965 100644
--- a/IkiWiki/Plugin/toc.pm
+++ b/IkiWiki/Plugin/toc.pm
@@ -9,7 +9,7 @@ use HTML::Parser;
sub import { #{{{
hook(type => "preprocess", id => "toc", call => \&preprocess);
- hook(type => "format", id => "toc", call => \&format);
+ hook(type => "sanitize", id => "toc", call => \&sanitize);
} # }}}
my %tocpages;
@@ -33,7 +33,7 @@ sub preprocess (@) { #{{{
}
} # }}}
-sub format (@) { #{{{
+sub sanitize (@) { #{{{
my %params=@_;
my $content=$params{content};
diff --git a/debian/changelog b/debian/changelog
index d851f35f6..bcf3c9ac5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ikiwiki (2.45) UNRELEASED; urgency=low
+
+ * toc: Add the table of contents at sanitize time, rather than at format
+ time. This allows the toc to be displayed when previewing an edit. It also
+ avoids headers in the page template from showing up in the toc.
+
+ -- Joey Hess <joeyh@debian.org> Sat, 26 Apr 2008 15:09:36 -0400
+
ikiwiki (2.44) unstable; urgency=medium
* Bring back the svnrepo setup file option. This is needed for
diff --git a/doc/plugins/toc/discussion.mdwn b/doc/plugins/toc/discussion.mdwn
index dc622425a..a09ae5703 100644
--- a/doc/plugins/toc/discussion.mdwn
+++ b/doc/plugins/toc/discussion.mdwn
@@ -6,3 +6,5 @@ picks it up. I suppose it parses the entire page rather than just the
rendered content. --[[JasonBlevins]]
Why doesn't the TOC appear in the edit page preview? It only appears when the page is finally rendered. This makes it somewhat difficult to organize headings, saving & re-editing all the time. My user page currently has a toc to play with: --[[sabr]]
+
+> Fixed. --[[Joey]]