1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5class Footnote extends AbstractMode
6{
7
8    /**
9     * Footnote constructor.
10     */
11    public function __construct()
12    {
13        global $PARSER_MODES;
14
15        $this->allowedModes = array_merge(
16            $PARSER_MODES['container'],
17            $PARSER_MODES['formatting'],
18            $PARSER_MODES['substition'],
19            $PARSER_MODES['protected'],
20            $PARSER_MODES['disabled']
21        );
22
23        unset($this->allowedModes[array_search('footnote', $this->allowedModes)]);
24    }
25
26    /** @inheritdoc */
27    public function connectTo($mode)
28    {
29        $this->Lexer->addEntryPattern(
30            '\x28\x28(?=.*\x29\x29)',
31            $mode,
32            'footnote'
33        );
34    }
35
36    /** @inheritdoc */
37    public function postConnect()
38    {
39        $this->Lexer->addExitPattern(
40            '\x29\x29',
41            'footnote'
42        );
43    }
44
45    /** @inheritdoc */
46    public function getSort()
47    {
48        return 150;
49    }
50}
51