1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5class Preformatted extends AbstractMode 6{ 7 /** @inheritdoc */ 8 public function connectTo($mode) 9 { 10 // Has hard coded awareness of lists... 11 $this->Lexer->addEntryPattern('\n (?![\*\-])', $mode, 'preformatted'); 12 $this->Lexer->addEntryPattern('\n\t(?![\*\-])', $mode, 'preformatted'); 13 14 // How to effect a sub pattern with the Lexer! 15 $this->Lexer->addPattern('\n ', 'preformatted'); 16 $this->Lexer->addPattern('\n\t', 'preformatted'); 17 } 18 19 /** @inheritdoc */ 20 public function postConnect() 21 { 22 $this->Lexer->addExitPattern('\n', 'preformatted'); 23 } 24 25 /** @inheritdoc */ 26 public function getSort() 27 { 28 return 20; 29 } 30} 31