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