1<?php
2/*
3 * Horizontal rulers:
4 *  * * *
5 *  ---
6 *  ___
7 */
8
9if(!defined('DOKU_INC')) die();
10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11require_once(DOKU_PLUGIN.'syntax.php');
12
13class syntax_plugin_markdowku_hr extends DokuWiki_Syntax_Plugin {
14
15    function getType()  { return 'container'; }
16    function getPType() { return 'block'; }
17    function getSort()  { return 8; } /* Before list block parsing. */
18
19    function connectTo($mode) {
20        /* We use two newlines, as we don't want to conflict with setext header
21         * parsing, but also have to be before list blocks. */
22        $this->Lexer->addSpecialPattern(
23            '\n[ ]{0,2}(?:[ ]?\*[ ]?){3,}[ \t]*(?=\n)',
24            $mode,
25            'plugin_markdowku_hr');
26
27        $this->Lexer->addSpecialPattern(
28            '\n[ ]{0,2}(?:[ ]?-[ ]?){3,}[ \t]*(?=\n)',
29            $mode,
30            'plugin_markdowku_hr');
31
32        $this->Lexer->addSpecialPattern(
33            '\n[ ]{0,2}(?:[ ]?_[ ]?){3,}[ \t]*(?=\n)',
34            $mode,
35            'plugin_markdowku_hr');
36    }
37
38    function handle($match, $state, $pos, Doku_Handler $handler) {
39        $handler->_addCall('hr', array(), $pos);
40        return true;
41    }
42
43    function render($mode, Doku_Renderer $renderer, $data) {
44        return true;
45    }
46}
47//Setup VIM: ex: et ts=4 enc=utf-8 :
48