summaryrefslogtreecommitdiff
path: root/platform/www/inc/Parsing/ParserMode/Footnote.php
blob: c399f98497d912974c7c81129446238e3ef1e9fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php

namespace dokuwiki\Parsing\ParserMode;

class Footnote extends AbstractMode
{

    /**
     * Footnote constructor.
     */
    public function __construct()
    {
        global $PARSER_MODES;

        $this->allowedModes = array_merge(
            $PARSER_MODES['container'],
            $PARSER_MODES['formatting'],
            $PARSER_MODES['substition'],
            $PARSER_MODES['protected'],
            $PARSER_MODES['disabled']
        );

        unset($this->allowedModes[array_search('footnote', $this->allowedModes)]);
    }

    /** @inheritdoc */
    public function connectTo($mode)
    {
        $this->Lexer->addEntryPattern(
            '\x28\x28(?=.*\x29\x29)',
            $mode,
            'footnote'
        );
    }

    /** @inheritdoc */
    public function postConnect()
    {
        $this->Lexer->addExitPattern(
            '\x29\x29',
            'footnote'
        );
    }

    /** @inheritdoc */
    public function getSort()
    {
        return 150;
    }
}