1<?php
2
3use dokuwiki\Extension\SyntaxPlugin;
4
5/**
6 * DokuWiki Plugin qc (Syntax Component)
7 *
8 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
9 * @author  Andreas Gohr <gohr@cosmocode.de>
10 */
11class syntax_plugin_qc extends SyntaxPlugin
12{
13    /** @inheritdoc */
14    public function getType()
15    {
16        return 'substition';
17    }
18
19    /** @inheritdoc */
20    public function getPType()
21    {
22        return 'normal';
23    }
24
25    /** @inheritdoc */
26    public function getSort()
27    {
28        return 150;
29    }
30
31    /** @inheritdoc */
32    public function connectTo($mode)
33    {
34        $this->Lexer->addSpecialPattern('~~NOQC~~', $mode, 'plugin_qc');
35    }
36
37    /** @inheritdoc */
38    public function handle($match, $state, $pos, Doku_Handler $handler)
39    {
40        return [];
41    }
42
43    /** @inheritdoc */
44    public function render($mode, Doku_Renderer $R, $data)
45    {
46        if ($mode != 'metadata') return false;
47
48        $R->meta['relation']['qcplugin_disabled'] = true;
49        return true;
50    }
51}
52