xref: /dokuwiki/inc/Parsing/ParserMode/Eol.php (revision d4f83172d9533c4d84f450fe22ef630816b21d75)
1be906b56SAndreas Gohr<?php
2be906b56SAndreas Gohr
3be906b56SAndreas Gohrnamespace dokuwiki\Parsing\ParserMode;
4be906b56SAndreas Gohr
5be906b56SAndreas Gohrclass Eol extends AbstractMode
6be906b56SAndreas Gohr{
7be906b56SAndreas Gohr    /** @inheritdoc */
8be906b56SAndreas Gohr    public function connectTo($mode)
9be906b56SAndreas Gohr    {
10*bcaec9f4SAndreas Gohr        $badModes = ['listblock', 'table'];
11be906b56SAndreas Gohr        if (in_array($mode, $badModes)) {
12be906b56SAndreas Gohr            return;
13be906b56SAndreas Gohr        }
14be906b56SAndreas Gohr        // see FS#1652, pattern extended to swallow preceding whitespace to avoid
15be906b56SAndreas Gohr        // issues with lines that only contain whitespace
16be906b56SAndreas Gohr        $this->Lexer->addSpecialPattern('(?:^[ \t]*)?\n', $mode, 'eol');
17be906b56SAndreas Gohr    }
18be906b56SAndreas Gohr
19be906b56SAndreas Gohr    /** @inheritdoc */
20be906b56SAndreas Gohr    public function getSort()
21be906b56SAndreas Gohr    {
22be906b56SAndreas Gohr        return 370;
23be906b56SAndreas Gohr    }
24be906b56SAndreas Gohr}
25