diff options
author | andi <andi@splitbrain.org> | 2005-04-10 19:59:16 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-04-10 19:59:16 +0200 |
commit | af587fa822e0477bda4288e75b171f81ea8e68ce (patch) | |
tree | d777c6f76b1127fd055dc2995e0782a20cc23cea /inc/parser/xhtml.php | |
parent | 4de671bc5e749ac76ad85252df59feb45c749eab (diff) | |
download | rpg-af587fa822e0477bda4288e75b171f81ea8e68ce.tar.gz rpg-af587fa822e0477bda4288e75b171f81ea8e68ce.tar.bz2 |
new parser: code for section editing added
darcs-hash:20050410175916-9977f-92bd9f70d66160b0f6188f42870d12b2e0964077.gz
Diffstat (limited to 'inc/parser/xhtml.php')
-rw-r--r-- | inc/parser/xhtml.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 63bd9a974..b66a92ec4 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -32,11 +32,15 @@ class Doku_Renderer_XHTML extends Doku_Renderer { var $entities = array(); var $interwiki = array(); + var $lastsec = 0; + function document_start() { ob_start(); } function document_end() { + // add button for last section if any + if($this->lastsec) $this->__secedit($this->lastsec,''); if ( count ($this->footnotes) > 0 ) { echo '<div class="footnotes">'.DOKU_LF; @@ -87,7 +91,16 @@ class Doku_Renderer_XHTML extends Doku_Renderer { echo '</div>'.DOKU_LF.'</div>'.DOKU_LF; } - function header($text, $level) { + function header($text, $level, $pos) { + global $conf; + //handle section editing + if($level <= $conf['maxseclevel']){ + // add button for last section if any + if($this->lastsec) $this->__secedit($this->lastsec,$pos-1); + // remember current position + $this->lastsec = $pos; + } + echo DOKU_LF.'<a name="'.$this->__headerToLink($text).'"></a><h'.$level.'>'; echo $this->__xmlEntities($text); echo "</h$level>".DOKU_LF; @@ -283,8 +296,7 @@ class Doku_Renderer_XHTML extends Doku_Renderer { if ( is_null($language) ) { $this->preformatted($text); } else { - - // Handle with Geshi here (needs tuning) + // Handle with Geshi here FIXME: strip first beginning newline require_once(DOKU_INC . 'inc/geshi.php'); $geshi = new GeSHi($text, strtolower($language), DOKU_INC . 'inc/geshi'); $geshi->enable_classes(); @@ -742,6 +754,13 @@ class Doku_Renderer_XHTML extends Doku_Renderer { function __headerToLink($title) { return preg_replace('/\W/','_',trim($title)); } + + /** + * Adds code for section editing button + */ + function __secedit($f, $t){ + print '<!-- SECTION ['.$f.'-'.$t.'] -->'; + } function __getLinkTitle($title, $default, & $isImage) { $isImage = FALSE; @@ -838,7 +857,7 @@ function interwikiImgExists($name) { * @deprecated -> resolve_pagename should be used */ function wikiPageExists($name) { - +msg("deprecated wikiPageExists called",-1); static $pages = array(); if ( array_key_exists($name,$pages) ) { |