1<?php
2/**
3 * DokuWiki Plugin Typography; Syntax typography fontsize
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
7 *
8 * provide fontsize2 plugin syntax compatibility
9 * @see also https://www.dokuwiki.org/plugin:fontsize2
10 */
11
12require_once(dirname(__FILE__).'/base.php');
13
14class syntax_plugin_typography_fontsize extends syntax_plugin_typography_base
15{
16    /**
17     * Connect pattern to lexer
18     */
19    public function preConnect()
20    {
21        // drop 'syntax_' from class name
22        $this->mode = substr(get_class($this), 7);
23
24        // syntax pattern
25        $this->pattern[1] = '<fs\b.*?>(?=.*?</fs>)';
26        $this->pattern[4] = '</fs>';
27    }
28
29    public function connectTo($mode)
30    {
31        if (plugin_isdisabled('fontsize2')) {
32            $this->Lexer->addEntryPattern($this->pattern[1], $mode, $this->mode);
33        }
34    }
35
36    public function postConnect()
37    {
38        if (plugin_isdisabled('fontsize2')) {
39            $this->Lexer->addExitPattern($this->pattern[4], $this->mode);
40        }
41    }
42
43}
44