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