1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5class Listblock extends AbstractMode
6{
7
8    /**
9     * Listblock constructor.
10     */
11    public function __construct()
12    {
13        global $PARSER_MODES;
14
15        $this->allowedModes = array_merge(
16            $PARSER_MODES['formatting'],
17            $PARSER_MODES['substition'],
18            $PARSER_MODES['disabled'],
19            $PARSER_MODES['protected']
20        );
21    }
22
23    /** @inheritdoc */
24    public function connectTo($mode)
25    {
26        $this->Lexer->addEntryPattern('[ \t]*\n {2,}[\-\*]', $mode, 'listblock');
27        $this->Lexer->addEntryPattern('[ \t]*\n\t{1,}[\-\*]', $mode, 'listblock');
28
29        $this->Lexer->addPattern('\n {2,}[\-\*]', 'listblock');
30        $this->Lexer->addPattern('\n\t{1,}[\-\*]', 'listblock');
31    }
32
33    /** @inheritdoc */
34    public function postConnect()
35    {
36        $this->Lexer->addExitPattern('\n', 'listblock');
37    }
38
39    /** @inheritdoc */
40    public function getSort()
41    {
42        return 10;
43    }
44}
45