Skip to content
Snippets Groups Projects
Commit 9773c5ed authored by joe.lapp's avatar joe.lapp
Browse files

$conf['toptoclevel'] specifying topmost level of TOC

Particularly useful with $conf['useheading']

darcs-hash:20050917041821-36b45-4187b687b6ade759035d0d695eb715f9192c1a7e.gz
parent 7c759785
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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 ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment