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