summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/dokuwiki.php1
-rw-r--r--inc/parser/handler.php14
2 files changed, 9 insertions, 6 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index 0c5cae8c3..e9afdb2be 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -29,6 +29,7 @@ $conf['htmlok'] = 0; //may raw HTML be embedded? This may b
$conf['phpok'] = 0; //may PHP code be embedded? Never do this on the internet! 0|1
$conf['dformat'] = 'Y/m/d H:i'; //dateformat accepted by PHPs date() function
$conf['signature'] = ' --- //[[@MAIL@|@NAME@]] @DATE@//'; //signature see wiki:config for details
+$conf['toptoclevel'] = 1; //Level starting with and below to include in AutoTOC (max. 5)
$conf['maxtoclevel'] = 3; //Up to which level include into AutoTOC (max. 5)
$conf['maxseclevel'] = 3; //Up to which level create editable sections (max. 5)
$conf['camelcase'] = 0; //Use CamelCase for linking? (I don't like it) 0|1
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 ) {