aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Parsing/ParserMode/Preformatted.php
blob: e7228367acd08cc235afae89767fec7298c1e6cc (plain) (blame)
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
<?php

namespace dokuwiki\Parsing\ParserMode;

class Preformatted extends AbstractMode
{
    /** @inheritdoc */
    public function connectTo($mode)
    {
        // Has hard coded awareness of lists...
        $this->Lexer->addEntryPattern('\n  (?![\*\-])', $mode, 'preformatted');
        $this->Lexer->addEntryPattern('\n\t(?![\*\-])', $mode, 'preformatted');

        // How to effect a sub pattern with the Lexer!
        $this->Lexer->addPattern('\n  ', 'preformatted');
        $this->Lexer->addPattern('\n\t', 'preformatted');
    }

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

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