[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Parsing/ParserMode/ -> Unformatted.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\Parsing\ParserMode;
   4  
   5  use dokuwiki\Parsing\Handler;
   6  
   7  class Unformatted extends AbstractMode
   8  {
   9      /** @inheritdoc */
  10      public function getSort()
  11      {
  12          return 170;
  13      }
  14  
  15      /** @inheritdoc */
  16      public function connectTo($mode)
  17      {
  18          $this->Lexer->addEntryPattern('<nowiki>(?=.*</nowiki>)', $mode, 'unformatted');
  19          $this->Lexer->addEntryPattern('%%(?=.*%%)', $mode, 'unformattedalt');
  20      }
  21  
  22      /** @inheritdoc */
  23      public function postConnect()
  24      {
  25          $this->Lexer->addExitPattern('</nowiki>', 'unformatted');
  26          $this->Lexer->addExitPattern('%%', 'unformattedalt');
  27          $this->Lexer->mapHandler('unformattedalt', 'unformatted');
  28      }
  29  
  30      /** @inheritdoc */
  31      public function handle($match, $state, $pos, Handler $handler)
  32      {
  33          if ($state == DOKU_LEXER_UNMATCHED) {
  34              $handler->addCall('unformatted', [$match], $pos);
  35          }
  36          return true;
  37      }
  38  }