1<?php
2
3use dokuwiki\Extension\SyntaxPlugin;
4use dokuwiki\Parsing\Handler;
5
6/**
7 * BBCode plugin: allows BBCode markup familiar from forum software
8 *
9 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
10 * @author     Esther Brunner <esther@kaffeehaus.ch>
11 */
12class syntax_plugin_bbcode_underline extends SyntaxPlugin
13{
14    /** @inheritdoc */
15    public function getType()
16    {
17        return 'formatting';
18    }
19    /** @inheritdoc */
20    public function getAllowedTypes()
21    {
22        return ['formatting', 'substition', 'disabled'];
23    }
24    /** @inheritdoc */
25    public function getSort()
26    {
27        return 105;
28    }
29    /** @inheritdoc */
30    public function connectTo($mode)
31    {
32        $this->Lexer->addEntryPattern('\[u\](?=.*?\x5B/u\x5D)', $mode, 'underline');
33    }
34    /** @inheritdoc */
35    public function postConnect()
36    {
37        $this->Lexer->addExitPattern('\[/u\]', 'underline');
38    }
39
40    /** @inheritdoc */
41    public function handle($match, $state, $pos, Handler $handler)
42    {
43        return [];
44    }
45
46    /** @inheritdoc */
47    public function render($format, Doku_Renderer $renderer, $data)
48    {
49        return true;
50    }
51}
52