function document_end() { parent::document_end(); // Prepare the TOC global $TOC, $ID; $meta = array(); // NOTOC, and no forceTOC if ($this->info['toc'] === false && !($this->info['forceTOC'] || $this->meta['forceTOC'])) { $TOC = $this->toc = array(); $meta['internal']['toc'] = false; $meta['description']['tableofcontents'] = array(); $meta['forceTOC'] = false; } else { if ($this->info['forceTOC'] || $this->meta['forceTOC'] || utf8_strlen(strip_tags($this->doc)) >= $this->getConf('documentlengthfortoc') && count($this->toc) > 1) { $TOC = $this->toc; // This is a little bit like cheating ... but this will force the TOC into the metadata $meta = array(); $meta['internal']['toc'] = true; $meta['forceTOC'] = $this->info['forceTOC'] || $this->meta['forceTOC']; $meta['description']['tableofcontents'] = $TOC; } } // allways write new metadata p_set_metadata($ID, $meta); $this->doc = preg_replace('#<p( class=".*?")?>\\s*</p>#', '', $this->doc); }
function document_end() { parent::document_end(); // make sure there are no empty paragraphs $this->doc = preg_replace('#<p[^>]*>\\s*<!--PN-->.*?(?:</p>)#', '', $this->doc); // remove PN comment again (see _getLink()) $this->doc = preg_replace('/<!--PN-->/', '', $this->doc); }
function document_end() { // Pump the last doc $this->sections[$this->sectionNumber] = array('level' => $this->previousNodeLevel, 'position' => $this->previousNodePosition, 'content' => $this->doc, 'text' => $this->previousSectionTextHeader); // Recreate the doc $this->doc = ''; foreach ($this->sections as $sectionNumber => $section) { // The content $this->doc .= $section['content']; // No TOC or bar for an admin page global $ACT; if ($ACT != 'admin' and $ACT != 'search') { // TOC After the content if ($this->info['toc'] == true and $section['level'] == 1 and $section['position'] == 1) { global $conf; if (count($this->toc) > $conf['tocminheads']) { global $TOC; $TOC = $this->toc; $this->doc .= tpl_toc($return = true); } } // Adbar after the content // Adbar later // if ($section['level'] == 2 and // $section['position'] == 1 and // $ID <> 'adbar12' and // $ID <> 'start' // ) { // // // $ID <> 'adbar12' to not come in a recursive call // // as tpl_include_call also the renderer process // // $this->doc .= tpl_include_page('adbar12', $print = false, $propagate = true); // // } } } parent::document_end(); }