1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5use dokuwiki\Parsing\ModeRegistry; 6 7class Footnote extends AbstractMode 8{ 9 /** 10 * Footnote constructor. 11 */ 12 public function __construct() 13 { 14 $this->allowedModes = ModeRegistry::getInstance()->getModesForCategories([ 15 ModeRegistry::CATEGORY_CONTAINER, 16 ModeRegistry::CATEGORY_FORMATTING, 17 ModeRegistry::CATEGORY_SUBSTITION, 18 ModeRegistry::CATEGORY_PROTECTED, 19 ModeRegistry::CATEGORY_DISABLED, 20 ]); 21 22 unset($this->allowedModes[array_search('footnote', $this->allowedModes)]); 23 } 24 25 /** @inheritdoc */ 26 public function connectTo($mode) 27 { 28 $this->Lexer->addEntryPattern( 29 '\x28\x28(?=.*\x29\x29)', 30 $mode, 31 'footnote' 32 ); 33 } 34 35 /** @inheritdoc */ 36 public function postConnect() 37 { 38 $this->Lexer->addExitPattern( 39 '\x29\x29', 40 'footnote' 41 ); 42 } 43 44 /** @inheritdoc */ 45 public function getSort() 46 { 47 return 150; 48 } 49} 50