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.
parent
2d78c4d9a7
commit
9652cdfe2e
|
@ -9,7 +9,7 @@ use HTML::Parser;
|
||||||
|
|
||||||
sub import { #{{{
|
sub import { #{{{
|
||||||
hook(type => "preprocess", id => "toc", call => \&preprocess);
|
hook(type => "preprocess", id => "toc", call => \&preprocess);
|
||||||
hook(type => "format", id => "toc", call => \&format);
|
hook(type => "sanitize", id => "toc", call => \&sanitize);
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
my %tocpages;
|
my %tocpages;
|
||||||
|
@ -33,7 +33,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
sub format (@) { #{{{
|
sub sanitize (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
my $content=$params{content};
|
my $content=$params{content};
|
||||||
|
|
||||||
|
|
|
@ -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
|
ikiwiki (2.44) unstable; urgency=medium
|
||||||
|
|
||||||
* Bring back the svnrepo setup file option. This is needed for
|
* Bring back the svnrepo setup file option. This is needed for
|
||||||
|
|
|
@ -6,3 +6,5 @@ picks it up. I suppose it parses the entire page rather than just the
|
||||||
rendered content. --[[JasonBlevins]]
|
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]]
|
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]]
|
||||||
|
|
Loading…
Reference in New Issue