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.
 
 
 
 
 

38 lines
692 B

  1. <?php
  2. namespace dokuwiki\Parsing\ParserMode;
  3. class Filelink extends AbstractMode
  4. {
  5. protected $pattern;
  6. /** @inheritdoc */
  7. public function preConnect()
  8. {
  9. $ltrs = '\w';
  10. $gunk = '/\#~:.?+=&%@!\-';
  11. $punc = '.:?\-;,';
  12. $any = $ltrs . $gunk . $punc;
  13. $this->pattern = '\b(?i)file(?-i)://[' . $any . ']+?[' .
  14. $punc . ']*[^' . $any . ']';
  15. }
  16. /** @inheritdoc */
  17. public function connectTo($mode)
  18. {
  19. $this->Lexer->addSpecialPattern(
  20. $this->pattern,
  21. $mode,
  22. 'filelink'
  23. );
  24. }
  25. /** @inheritdoc */
  26. public function getSort()
  27. {
  28. return 360;
  29. }
  30. }