Preformatted.php 759 B

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