2 if(!defined('DOKU_INC')) die('meh.');
3 require_once DOKU_INC . 'inc/parser/xhtml.php';
6 * The summary XHTML form selects either up to the first two paragraphs
7 * it find in a page or the first section (whichever comes first)
8 * It strips out the table of contents if one exists
9 * Section divs are not used - everything should be nested in a single
10 * div with CSS class "page"
11 * Headings have their a name link removed and section editing links
13 * It also attempts to capture the first heading in a page for
14 * use as the title of the page.
17 * @author Harry Fuecks <hfuecks@gmail.com>
18 * @todo Is this currently used anywhere? Should it?
20 class Doku_Renderer_xhtmlsummary extends Doku_Renderer_xhtml {
22 // Namespace these variables to
23 // avoid clashes with parent classes
24 var $sum_paragraphs = 0;
25 var $sum_capture = true;
26 var $sum_inSection = false;
27 var $sum_summary = '';
28 var $sum_pageTitle = false;
30 function document_start() {
31 $this->doc .= DOKU_LF.'<div>'.DOKU_LF;
34 function document_end() {
35 $this->doc = $this->sum_summary;
36 $this->doc .= DOKU_LF.'</div>'.DOKU_LF;
39 // FIXME not supported anymore
41 $this->sum_summary .= $this->doc;
44 // FIXME not supported anymore
45 function toc_close() {
49 function header($text, $level, $pos) {
50 if ( !$this->sum_pageTitle ) {
51 $this->info['sum_pagetitle'] = $text;
52 $this->sum_pageTitle = true;
54 $this->doc .= DOKU_LF.'<h'.$level.'>';
55 $this->doc .= $this->_xmlEntities($text);
56 $this->doc .= "</h$level>".DOKU_LF;
59 function section_open($level) {
60 if ( $this->sum_capture ) {
61 $this->sum_inSection = true;
65 function section_close() {
66 if ( $this->sum_capture && $this->sum_inSection ) {
67 $this->sum_summary .= $this->doc;
68 $this->sum_capture = false;
73 if ( $this->sum_capture && $this->sum_paragraphs < 2 ) {
74 $this->sum_paragraphs++;
81 if ( $this->sum_capture && $this->sum_paragraphs >= 2 ) {
82 $this->sum_summary .= $this->doc;
83 $this->sum_capture = false;
90 //Setup VIM: ex: et ts=2 :