1<?php
2// must be run within Dokuwiki
3if(!defined('DOKU_INC')) die();
4
5/**
6 * All DokuWiki plugins to extend the parser/rendering mechanism
7 * need to inherit from this class
8 */
9class syntax_plugin_poem_eol extends DokuWiki_Syntax_Plugin {
10
11    function getType() { return 'poem'; }
12    function getPType() { return 'normal'; }
13    function getSort() { return 369; }
14
15    /**
16     * Connect pattern to lexer
17     */
18    function connectTo($mode) {
19        $this->Lexer->addSpecialPattern('(?:^[ \t]*)?\n',$mode,'plugin_poem_eol');
20    }
21
22    /**
23     * Handle the match
24     */
25    function handle($match, $state, $pos, Doku_Handler $handler){return true;}
26
27    /**
28     * Create output
29     */
30    function render($format, Doku_Renderer $renderer, $data) {
31        if($format == 'xhtml'){
32            $renderer->doc .= "<br/>\n";
33            return true;
34        } else if ($format == 'metadata') {
35            $renderer->doc .= "\n";
36            return true;
37        }
38        return false;
39    }
40}
41