diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index b41d08685c6b223b85e0fc87d7da5ddcf839c8cf..7f9ef2e9cc7998fcbbe0d8c645eb5cd4cc46aac3 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -37,6 +37,7 @@ $conf['phpok'] = 0; //may PHP code be embedded? Never do t $conf['dformat'] = '%Y/%m/%d %H:%M'; //dateformat accepted by PHPs strftime() 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['tocminheads'] = 3; //Minimum amount of headlines that determines if a TOC is built $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 @@ -126,7 +127,7 @@ $conf['broken_iua'] = 0; //Platform with broken ignore_user_abor $conf['xsendfile'] = 0; //Use X-Sendfile (1 = lighttpd, 2 = standard) $conf['xmlrpc'] = 0; //Enable/disable XML-RPC interface $conf['renderer_xhtml'] = 'xhtml'; //renderer to use for main page generation -$conf['rememberme'] = 1; //Enable/disable remember me on login +$conf['rememberme'] = 1; //Enable/disable remember me on login //Set target to use when creating links - leave empty for same window $conf['target']['wiki'] = ''; diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index bad1a21dedc97f56dc4bee6ab3df4bd7512c0d94..545f48b4ec6ec3fcf65c0bc3b8fd95c16c1d2afa 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -84,7 +84,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } // Prepare the TOC - if($this->info['toc'] && is_array($this->toc) && count($this->toc) > 2){ + global $conf; + if($this->info['toc'] && is_array($this->toc) && $conf['tocminheads'] && count($this->toc) >= $conf['tocminheads']){ global $TOC; $TOC = $this->toc; } diff --git a/inc/template.php b/inc/template.php index 6faf4881da997b2a619daa6ed02cb8b7dbb9e40e..9d29ad2919a14f24739196e7f06c9d497b1bbef0 100644 --- a/inc/template.php +++ b/inc/template.php @@ -152,6 +152,7 @@ function tpl_toc($return=false){ global $ID; global $REV; global $INFO; + global $conf; $toc = array(); if(is_array($TOC)){ @@ -166,7 +167,7 @@ function tpl_toc($return=false){ $tocok = true; } $toc = $meta['description']['tableofcontents']; - if(!$tocok || !is_array($toc) || count($toc) < 3){ + if(!$tocok || !is_array($toc) || !$conf['tocminheads'] || count($toc) < $conf['tocminheads']){ $toc = array(); } }elseif($ACT == 'admin'){