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