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