Quotes.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace dokuwiki\Parsing\ParserMode;
  3. class Quotes extends AbstractMode
  4. {
  5. /** @inheritdoc */
  6. public function connectTo($mode)
  7. {
  8. global $conf;
  9. $ws = '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\''; // whitespace
  10. $punc = ';,\.?!';
  11. if ($conf['typography'] == 2) {
  12. $this->Lexer->addSpecialPattern(
  13. "(?<=^|[$ws])'(?=[^$ws$punc])",
  14. $mode,
  15. 'singlequoteopening'
  16. );
  17. $this->Lexer->addSpecialPattern(
  18. "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])",
  19. $mode,
  20. 'singlequoteclosing'
  21. );
  22. $this->Lexer->addSpecialPattern(
  23. "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])",
  24. $mode,
  25. 'apostrophe'
  26. );
  27. }
  28. $this->Lexer->addSpecialPattern(
  29. "(?<=^|[$ws])\"(?=[^$ws$punc])",
  30. $mode,
  31. 'doublequoteopening'
  32. );
  33. $this->Lexer->addSpecialPattern(
  34. "\"",
  35. $mode,
  36. 'doublequoteclosing'
  37. );
  38. }
  39. /** @inheritdoc */
  40. public function getSort()
  41. {
  42. return 280;
  43. }
  44. }