diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-02-24 16:12:21 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-02-24 16:12:21 +0100 |
commit | b8c943a4dc3a62e354013977a018c677b13a20c5 (patch) | |
tree | 4ef627223dacfc12edd2f7b5bd243cebeee72954 /inc/parser/handler.php | |
parent | c2f250d59839ed7e003550ee117e313b43469879 (diff) | |
download | rpg-b8c943a4dc3a62e354013977a018c677b13a20c5.tar.gz rpg-b8c943a4dc3a62e354013977a018c677b13a20c5.tar.bz2 |
removed deprecated TOC code
darcs-hash:20060224151221-7ad00-314d411cb22d2cd59079751f31cf4b4c49a7f0b6.gz
Diffstat (limited to 'inc/parser/handler.php')
-rw-r--r-- | inc/parser/handler.php | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index dc5315fdd..1b73c458f 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -35,13 +35,6 @@ class Doku_Handler { $this->calls = $B->process($this->calls); } -/** FIXME deprecated - if ( $this->meta['toc'] ) { - $T = & new Doku_Handler_Toc(); - $this->calls = $T->process($this->calls); - } -*/ - array_unshift($this->calls,array('document_start',array(),0)); $last_call = end($this->calls); array_push($this->calls,array('document_end',array(),$last_call[2])); @@ -1494,186 +1487,4 @@ class Doku_Handler_Block { } } -//------------------------------------------------------------------------ - -/** FIXME deprecated - -define('DOKU_TOC_OPEN',1); -define('DOKU_TOCBRANCH_OPEN',2); -define('DOKU_TOCITEM_OPEN',3); -define('DOKU_TOC_ELEMENT',4); -define('DOKU_TOCITEM_CLOSE',5); -define('DOKU_TOCBRANCH_CLOSE',6); -define('DOKU_TOC_CLOSE',7); - -class Doku_Handler_Toc { - - var $calls = array(); - var $tocStack = array(); - var $toc = array(); - var $numHeaders = 0; - - function process($calls) { - #FIXME can this be done better? - - global $conf; - - if ( isset($conf['toptoclevel']) ) { - // retrieve vars once to save time - $toplevel = $conf['toptoclevel']; - } else { - $toplevel = 0; - } - - if ( isset($conf['maxtoclevel']) ) { - $maxlevel = $conf['maxtoclevel']; - } else { - $maxlevel = 0; - } - - foreach ( $calls as $call ) { - if ( !isset($call[1][1]) ) { - $this->calls[] = $call; - continue; - } - $level = $call[1][1]; - if ( $call[0] == 'header' && $level >= $toplevel && $level <= $maxlevel ) { - $this->numHeaders++; - $this->addToToc($level - $toplevel + 1, $call); - } - $this->calls[] = $call; - } - - // Complete the table of contents then prepend to the calls - $this->finalizeToc($call); - return $this->calls; - } - - function addToToc($depth, $call) { - - // If it's the opening item... - if ( count ( $this->toc) == 0 ) { - - $this->addTocCall($call, DOKU_TOC_OPEN); - - for ( $i = 1; $i <= $depth; $i++ ) { - - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCBRANCH_OPEN); - - if ( $i != $depth ) { - $this->addTocCall(array($call[0],array($call[1][0], $i, '', TRUE),$call[2]), DOKU_TOCITEM_OPEN); - } else { - $this->addTocCall(array($call[0],array($call[1][0], $i),$call[2]), DOKU_TOCITEM_OPEN); - $this->addTocCall(array($call[0],array($call[1][0], $i),$call[2]), DOKU_TOC_ELEMENT); - } - - $this->tocStack[] = $i; - - } - return; - } - - $currentDepth = end($this->tocStack); - $initialDepth = $currentDepth; - - // Create new branches as needed - if ( $depth > $currentDepth ) { - - for ($i = $currentDepth+1; $i <= $depth; $i++ ) { - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCBRANCH_OPEN); - // It's just a filler - if ( $i != $depth ) { - $this->addTocCall(array($call[0],array($call[1][0], $i, '', TRUE),$call[2]), DOKU_TOCITEM_OPEN); - } else { - $this->addTocCall(array($call[0],array($call[1][0], $i),$call[2]), DOKU_TOCITEM_OPEN); - } - $this->tocStack[] = $i; - } - - $currentDepth = $i-1; - - } - - // Going down - if ( $depth < $currentDepth ) { - for ( $i = $currentDepth; $i >= $depth; $i-- ) { - if ( $i != $depth ) { - array_pop($this->tocStack); - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCITEM_CLOSE); - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCBRANCH_CLOSE); - } else { - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCITEM_CLOSE); - $this->addTocCall(array($call[0],array($call[1][0],$i),$call[2]), DOKU_TOCITEM_OPEN); - $this->addTocCall($call, DOKU_TOC_ELEMENT); - return; - } - } - } - - if ( $depth == $initialDepth ) { - $this->addTocCall($call, DOKU_TOCITEM_CLOSE); - $this->addTocCall($call, DOKU_TOCITEM_OPEN); - } - - $this->addTocCall($call, DOKU_TOC_ELEMENT); - - - } - - function addTocCall($call, $type) { - switch ( $type ) { - case DOKU_TOC_OPEN: - $this->toc[] = array('toc_open',array(),$call[2]); - break; - - case DOKU_TOCBRANCH_OPEN: - $this->toc[] = array('tocbranch_open',array($call[1][1]),$call[2]); - break; - - case DOKU_TOCITEM_OPEN: - if ( isset( $call[1][3] ) ) { - $this->toc[] = array('tocitem_open',array($call[1][1], TRUE),$call[2]); - } else { - $this->toc[] = array('tocitem_open',array($call[1][1]),$call[2]); - } - break; - - case DOKU_TOC_ELEMENT: - $this->toc[] = array('tocelement',array($call[1][1],$call[1][0]),$call[2]); - break; - - case DOKU_TOCITEM_CLOSE: - $this->toc[] = array('tocitem_close',array($call[1][1]),$call[2]); - break; - - case DOKU_TOCBRANCH_CLOSE: - $this->toc[] = array('tocbranch_close',array($call[1][1]),$call[2]); - break; - - case DOKU_TOC_CLOSE: - if ( count($this->toc) > 0 ) { - $this->toc[] = array('toc_close',array(),$call[2]); - } - break; - } - } - - function finalizeToc($call) { - global $conf; - if ( isset($conf['maxtoclevel']) && $this->numHeaders < $conf['maxtoclevel'] ) { - return; - } - if ( count ($this->tocStack) > 0 ) { - while ( NULL !== ($toc = array_pop($this->tocStack)) ) { - $this->addTocCall(array($call[0],array('',$toc),$call[2]), DOKU_TOCITEM_CLOSE); - $this->addTocCall(array($call[0],array('',$toc),$call[2]), DOKU_TOCBRANCH_CLOSE); - } - } - $this->addTocCall($call, DOKU_TOC_CLOSE); - $this->calls = array_merge($this->toc, $this->calls); - } - -} -*/ - //Setup VIM: ex: et ts=4 enc=utf-8 : |