* @author Chris Smith
* @author Danny Lin
*/
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_INC . 'inc/parser/xhtml.php';
/**
* The Renderer
*/
class renderer_plugin_header3 extends Doku_Renderer_xhtml {
function canRender($format) {
return ($format=='xhtml');
}
function reset() {
$this->doc = '';
$this->footnotes = array();
$this->lastsec = 0;
$this->store = '';
$this->_counter = array();
}
/**
* Replace the normal linebreak and render it as an XHTML Linebreak
* @param $text the text to output
*/
function cdata($text) {
$this->doc .= str_replace("\n","
\n",$this->_xmlEntities($text));
}
/**
* $sectionedits is private and cannot be accessed by plugins,
* so this dirty hack is required
*
* Get rid of this renderer if it's fixed...
*/
public $sectionedits = array(); // A stack of section edit data
/**
* Copied from xhtml.php, no change
*/
public function startSectionEdit($start, $type, $title = null) {
static $lastsecid = 0;
$this->sectionedits[] = array(++$lastsecid, $start, $type, $title);
return 'sectionedit' . $lastsecid;
}
public function finishSectionEdit($end = null) {
list($id, $start, $type, $title) = array_pop($this->sectionedits);
if (!is_null($end) && $end <= $start) {
return;
}
$this->doc .= "';
}
function document_end() {
// Finish open section edits.
while (count($this->sectionedits) > 0) {
if ($this->sectionedits[count($this->sectionedits) - 1][1] <= 1) {
// If there is only one section, do not write a section edit
// marker.
array_pop($this->sectionedits);
} else {
$this->finishSectionEdit();
}
}
if ( count ($this->footnotes) > 0 ) {
$this->doc .= ''.DOKU_LF;
}
// Prepare the TOC
global $conf;
if($this->info['toc'] && is_array($this->toc) && $conf['tocminheads'] && count($this->toc) >= $conf['tocminheads']){
global $TOC;
$TOC = $this->toc;
}
// make sure there are no empty paragraphs
$this->doc = preg_replace('#\s*
#','',$this->doc);
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :