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