diff options
Diffstat (limited to 'inc/parser/handler.php')
-rw-r--r-- | inc/parser/handler.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 20a9433bd..c165e0a87 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -1489,12 +1489,16 @@ class Doku_Handler_Toc { function process($calls) { #FIXME can this be done better? - global $conf; + + global $conf; + $toplevel = $conf['toptoclevel']; // retrieve vars once to save time + $maxlevel = $conf['maxtoclevel']; foreach ( $calls as $call ) { - if ( $call[0] == 'header' && $call[1][1] <= $conf['maxtoclevel'] ) { + $level = $call[1][1]; + if ( $call[0] == 'header' && $level >= $toplevel && $level <= $maxlevel ) { $this->numHeaders++; - $this->addToToc($call); + $this->addToToc($level - $toplevel + 1, $call); } $this->calls[] = $call; } @@ -1504,9 +1508,7 @@ class Doku_Handler_Toc { return $this->calls; } - function addToToc($call) { - - $depth = $call[1][1]; + function addToToc($depth, $call) { // If it's the opening item... if ( count ( $this->toc) == 0 ) { |