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.
 
 
 
 
 

93 lines
2.7 KiB

  1. <?php
  2. use dokuwiki\Debug\PropertyDeprecationHelper;
  3. use dokuwiki\Parsing\Parser;
  4. /**
  5. * Define various types of modes used by the parser - they are used to
  6. * populate the list of modes another mode accepts
  7. */
  8. global $PARSER_MODES;
  9. $PARSER_MODES = [
  10. // containers are complex modes that can contain many other modes
  11. // hr breaks the principle but they shouldn't be used in tables / lists
  12. // so they are put here
  13. 'container' => ['listblock', 'table', 'quote', 'hr'],
  14. // some mode are allowed inside the base mode only
  15. 'baseonly' => ['header'],
  16. // modes for styling text -- footnote behaves similar to styling
  17. 'formatting' => [
  18. 'strong', 'emphasis', 'underline', 'monospace', 'subscript', 'superscript', 'deleted', 'footnote'
  19. ],
  20. // modes where the token is simply replaced - they can not contain any
  21. // other modes
  22. 'substition' => [
  23. 'acronym', 'smiley', 'wordblock', 'entity', 'camelcaselink', 'internallink', 'media', 'externallink',
  24. 'linebreak', 'emaillink', 'windowssharelink', 'filelink', 'notoc', 'nocache', 'multiplyentity', 'quotes', 'rss'
  25. ],
  26. // modes which have a start and end token but inside which
  27. // no other modes should be applied
  28. 'protected' => ['preformatted', 'code', 'file'],
  29. // inside this mode no wiki markup should be applied but lineendings
  30. // and whitespace isn't preserved
  31. 'disabled' => ['unformatted'],
  32. // used to mark paragraph boundaries
  33. 'paragraphs' => ['eol'],
  34. ];
  35. /**
  36. * Class Doku_Parser
  37. *
  38. * @deprecated 2018-05-04
  39. */
  40. class Doku_Parser extends Parser
  41. {
  42. use PropertyDeprecationHelper {
  43. __set as protected deprecationHelperMagicSet;
  44. __get as protected deprecationHelperMagicGet;
  45. }
  46. /** @inheritdoc */
  47. public function __construct(Doku_Handler $handler = null)
  48. {
  49. dbg_deprecated(Parser::class);
  50. $this->deprecatePublicProperty('modes', self::class);
  51. $this->deprecatePublicProperty('connected', self::class);
  52. if (!$handler instanceof \Doku_Handler) {
  53. $handler = new Doku_Handler();
  54. }
  55. parent::__construct($handler);
  56. }
  57. public function __set($name, $value)
  58. {
  59. if ($name === 'Handler') {
  60. $this->handler = $value;
  61. return;
  62. }
  63. if ($name === 'Lexer') {
  64. $this->lexer = $value;
  65. return;
  66. }
  67. $this->deprecationHelperMagicSet($name, $value);
  68. }
  69. public function __get($name)
  70. {
  71. if ($name === 'Handler') {
  72. return $this->handler;
  73. }
  74. if ($name === 'Lexer') {
  75. return $this->lexer;
  76. }
  77. return $this->deprecationHelperMagicGet($name);
  78. }
  79. }