1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5use dokuwiki\Parsing\Handler; 6 7class Eol extends AbstractMode 8{ 9 /** @inheritdoc */ 10 public function getSort() 11 { 12 return 370; 13 } 14 15 /** @inheritdoc */ 16 public function connectTo($mode) 17 { 18 if (in_array($mode, $this->registry->getBlockEolModes())) { 19 return; 20 } 21 // see FS#1652, pattern extended to swallow preceding whitespace to avoid 22 // issues with lines that only contain whitespace 23 $this->Lexer->addSpecialPattern('(?:^[ \t]*)?\n', $mode, 'eol'); 24 } 25 26 /** @inheritdoc */ 27 public function handle($match, $state, $pos, Handler $handler) 28 { 29 $handler->addCall('eol', [], $pos); 30 return true; 31 } 32} 33