[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/ -> Strikethrough.php (source)

   1  <?php
   2  
   3  /*
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2019 The s9e Authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Plugins\Litedown\Parser\Passes;
   9  class Strikethrough extends AbstractPass
  10  {
  11  	public function parse()
  12      {
  13          $pos = $this->text->indexOf('~~');
  14          if ($pos === \false)
  15              return;
  16          \preg_match_all('/~~[^\\x17]+?~~(?!~)/', $this->text, $matches, \PREG_OFFSET_CAPTURE, $pos);
  17          foreach ($matches[0] as $_4b034d25)
  18          {
  19              list($match, $matchPos) = $_4b034d25;
  20              $matchLen = \strlen($match);
  21              $endPos   = $matchPos + $matchLen - 2;
  22              $this->parser->addTagPair('DEL', $matchPos, 2, $endPos, 2);
  23              $this->text->overwrite($matchPos, 2);
  24              $this->text->overwrite($endPos, 2);
  25          }
  26      }
  27  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1