You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.1 KiB

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