1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5use dokuwiki\Parsing\ModeRegistry; 6 7class Listblock extends AbstractMode 8{ 9 /** 10 * Listblock constructor. 11 */ 12 public function __construct() 13 { 14 $this->allowedModes = ModeRegistry::getInstance()->getModesForCategories([ 15 ModeRegistry::CATEGORY_FORMATTING, 16 ModeRegistry::CATEGORY_SUBSTITION, 17 ModeRegistry::CATEGORY_DISABLED, 18 ModeRegistry::CATEGORY_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