123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- class Doku_Renderer_xhtmlsummary extends Doku_Renderer_xhtml {
-
-
- protected $sum_paragraphs = 0;
- protected $sum_capture = true;
- protected $sum_inSection = false;
- protected $sum_summary = '';
- protected $sum_pageTitle = false;
-
- public function document_start() {
- $this->doc .= DOKU_LF.'<div>'.DOKU_LF;
- }
-
- public function document_end() {
- $this->doc = $this->sum_summary;
- $this->doc .= DOKU_LF.'</div>'.DOKU_LF;
- }
-
- public function header($text, $level, $pos) {
- if ( !$this->sum_pageTitle ) {
- $this->info['sum_pagetitle'] = $text;
- $this->sum_pageTitle = true;
- }
- $this->doc .= DOKU_LF.'<h'.$level.'>';
- $this->doc .= $this->_xmlEntities($text);
- $this->doc .= "</h$level>".DOKU_LF;
- }
-
- public function section_open($level) {
- if ( $this->sum_capture ) {
- $this->sum_inSection = true;
- }
- }
-
- public function section_close() {
- if ( $this->sum_capture && $this->sum_inSection ) {
- $this->sum_summary .= $this->doc;
- $this->sum_capture = false;
- }
- }
-
- public function p_open() {
- if ( $this->sum_capture && $this->sum_paragraphs < 2 ) {
- $this->sum_paragraphs++;
- }
- parent :: p_open();
- }
-
- public function p_close() {
- parent :: p_close();
- if ( $this->sum_capture && $this->sum_paragraphs >= 2 ) {
- $this->sum_summary .= $this->doc;
- $this->sum_capture = false;
- }
- }
- }
|