ikiwiki/doc/todo/toc_plugin:_set_a_header_ce...

29 lines
1.2 KiB
Plaintext
Raw Normal View History

2008-12-02 16:25:44 +01:00
It would be nice if the [[plugins/toc]] plugin let you specify a header level "ceiling" above which (or above and including which) the headers would not be incorporated into the toc.
Currently, the levels=X parameter lets you tweak how deep it will go for small headers, but I'd like to chop off the h1's (as I use them for my page title) -- [[Jon]]
2009-12-07 07:03:37 +01:00
> This change to toc.pm should do it. --[[KathrynAndersen]]
2009-12-10 13:40:42 +01:00
> > The patch looks vaguely OK to me but it's hard to tell without
> > context. It'd be much easier to review if you used unified diff
> > (`diff -u`), which is what `git diff` defaults to - almost all
> > projects prefer to receive changes as unified diffs (or as
> > branches in their chosen VCS, which is [[git]] here). --[[smcv]]
2009-12-07 07:03:37 +01:00
56,57c56,57
2009-12-07 07:05:35 +01:00
< my $curlevel;
< my $startlevel=0;
2009-12-07 07:03:37 +01:00
---
2009-12-07 07:05:35 +01:00
> my $startlevel=($params{startlevel} ? $params{startlevel} : 0);
> my $curlevel=$startlevel-1;
69a70
> # unless we're given startlevel as a parameter
73a75,79
> elsif (defined $params{startlevel}
> and $level < $params{startlevel})
> {
> return;
> }
2009-12-10 13:40:42 +01:00
[[!tag patch]]