1<?php
2/**
3 * DokuWiki Plugin Typography; Syntax typography fontcolor
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
7 *
8 * provide fontcolor plugin syntax compatibility
9 * @see also https://www.dokuwiki.org/plugin:fontcolor
10 */
11
12require_once(dirname(__FILE__).'/base.php');
13
14class syntax_plugin_typography_fontcolor 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] = '<fc\b.*?>(?=.*?</fc>)';
26        $this->pattern[4] = '</fc>';
27    }
28
29    public function connectTo($mode)
30    {
31        if (plugin_isdisabled('fontcolor')) {
32            $this->Lexer->addEntryPattern($this->pattern[1], $mode, $this->mode);
33        }
34    }
35
36    public function postConnect()
37    {
38        if (plugin_isdisabled('fontcolor')) {
39            $this->Lexer->addExitPattern($this->pattern[4], $this->mode);
40        }
41    }
42
43}
44