]> scripts.mit.edu Git - www/ikiwiki.git/blobdiff - doc/todo/toc_plugin:_set_a_header_ceiling___40__opposite_of_levels__61____41__.mdwn
(no commit message)
[www/ikiwiki.git] / doc / todo / toc_plugin:_set_a_header_ceiling___40__opposite_of_levels__61____41__.mdwn
index 547c7a80a09542dc9003da3d566187a8b7f1f0d4..ce51d90a349d1efbcc22d498b9248f9a9146a58d 100644 (file)
@@ -1,3 +1,28 @@
 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]]
+
+> This change to toc.pm should do it. --[[KathrynAndersen]]
+
+> > 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]]
+
+       56,57c56,57
+       <       my $curlevel;
+       <       my $startlevel=0;
+       ---
+       >       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;
+       >                       }
+
+[[!tag patch]]