Lexer->addEntryPattern($pattern, $mode, PluginUtility::getModeFromTag($this->getPluginComponent())); } } function postConnect() { foreach (self::TAGS as $tag) { $this->Lexer->addExitPattern('', PluginUtility::getModeFromTag($this->getPluginComponent())); } } function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER : $attributes = TagAttributes::createFromTagMatch($match,[],[],true); $callStackArray = $attributes->toCallStackArray(); return array( PluginUtility::STATE => $state, PluginUtility::ATTRIBUTES => $callStackArray ); case DOKU_LEXER_UNMATCHED : return PluginUtility::handleAndReturnUnmatchedData(self::TAG, $match, $handler); case DOKU_LEXER_EXIT : /** * Transform all paragraphs * with the type as class */ $callStack = CallStack::createFromHandler($handler); $openingCall = $callStack->moveToPreviousCorrespondingOpeningCall(); $attributes = $openingCall->getAttributes(); // if there is no EOL, we add one to create at minimal a paragraph $callStack->insertEolIfNextCallIsNotEolOrBlock(); $callStack->processEolToEndStack($attributes); /** * Check and add a scroll toggle if the * text is constrained by height */ Dimension::addScrollToggleOnClickIfNoControl($callStack); return array(PluginUtility::STATE => $state); } return array(); } /** * Render the output * @param string $format * @param Doku_Renderer $renderer * @param array $data - what the function handle() return'ed * @return boolean - rendered correctly? (however, returned value is not used at the moment) * @see DokuWiki_Syntax_Plugin::render() * * */ function render($format, Doku_Renderer $renderer, $data): bool { if ($format == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ $state = $data[PluginUtility::STATE]; switch ($state) { case DOKU_LEXER_EXIT : case DOKU_LEXER_ENTER : /** * The {@link DOKU_LEXER_EXIT} of the {@link syntax_plugin_combo_text::handle()} * has already created in the callstack the {@link syntax_plugin_combo_para} call */ $renderer->doc .= ""; break; case DOKU_LEXER_UNMATCHED : $renderer->doc .= PluginUtility::renderUnmatched($data); break; } return true; } // unsupported $mode return false; } }