summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2007-02-06 02:54:54 +0100
committerchris <chris@jalakai.co.uk>2007-02-06 02:54:54 +0100
commit169c72406cf283b0bb8c7e6ec8ee17e6e0be4f8b (patch)
tree1b5a1147cbdb20388a43e00893752460836a84ea /inc/parser
parente7856bea477397d242c532d448a8ade3f4014c68 (diff)
downloadrpg-169c72406cf283b0bb8c7e6ec8ee17e6e0be4f8b.tar.gz
rpg-169c72406cf283b0bb8c7e6ec8ee17e6e0be4f8b.tar.bz2
refactor xhtml TOC creation into a class function, FS#1058
- changed inc/parser/xhtml.php, render_TOC() function it now takes a toc array as a parameter - refactor render_TOC() and _tocitem() into static class functions The xhtml renderer can build its TOC using $this->render_TOC($this->toc) Templates can create a separate TOC using echo Doku_Renderer_xhtml::render_TOC(p_get_metadata($ID, 'description tableofcontents')); darcs-hash:20070206015454-9b6ab-b3bd7ff772b756f8aaf496cb319eb73994cdbd94.gz
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/xhtml.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 266bfcf4a..b2d5ad46b 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -79,7 +79,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// prepend the TOC
if($this->info['toc']){
- $this->doc = $this->render_TOC().$this->doc;
+ $this->doc = $this->render_TOC($this->toc).$this->doc;
}
// make sure there are no empty paragraphs
@@ -91,15 +91,15 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function render_TOC(){
- if(count($this->toc) < 3) return '';
+ function render_TOC($toc){
+ if(count($toc) < 3) return '';
global $lang;
$out = '<div class="toc">'.DOKU_LF;
$out .= '<div class="tocheader toctoggle" id="toc__header">';
$out .= $lang['toc'];
$out .= '</div>'.DOKU_LF;
$out .= '<div id="toc__inside">'.DOKU_LF;
- $out .= html_buildlist($this->toc,'toc',array($this,'_tocitem'));
+ $out .= html_buildlist($toc,'toc',array(__CLASS__,'_tocitem'));
$out .= '</div>'.DOKU_LF.'</div>'.DOKU_LF;
return $out;
}
@@ -109,7 +109,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*/
function _tocitem($item){
return '<span class="li"><a href="#'.$item['hid'].'" class="toc">'.
- $this->_xmlEntities($item['title']).'</a></span>';
+ Doku_Renderer_xhtml::_xmlEntities($item['title']).'</a></span>';
}
function toc_additem($id, $text, $level) {