1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5class Preformatted extends AbstractMode
6{
7
8    /** @inheritdoc */
9    public function connectTo($mode)
10    {
11        // Has hard coded awareness of lists...
12        $this->Lexer->addEntryPattern('\n  (?![\*\-])', $mode, 'preformatted');
13        $this->Lexer->addEntryPattern('\n\t(?![\*\-])', $mode, 'preformatted');
14
15        // How to effect a sub pattern with the Lexer!
16        $this->Lexer->addPattern('\n  ', 'preformatted');
17        $this->Lexer->addPattern('\n\t', 'preformatted');
18    }
19
20    /** @inheritdoc */
21    public function postConnect()
22    {
23        $this->Lexer->addExitPattern('\n', 'preformatted');
24    }
25
26    /** @inheritdoc */
27    public function getSort()
28    {
29        return 20;
30    }
31}
32