Lexer->addEntryPattern(self::ENTRY_PATTERN, $mode, PluginUtility::getModeFromTag($this->getPluginComponent())); } public function postConnect() { $this->Lexer->addExitPattern(self::EXIT_PATTERN, PluginUtility::getModeFromTag($this->getPluginComponent())); } /** * Handle the syntax * * At the end of the parser, the `section_open` and `section_close` calls * are created in {@link action_plugin_combo_instructionspostprocessing} * and the text inside for the toc is captured * * @param string $match * @param int $state * @param int $pos * @param Doku_Handler $handler * @return array */ public function handle($match, $state, $pos, Doku_Handler $handler): array { switch ($state) { case DOKU_LEXER_EXIT: case DOKU_LEXER_ENTER: $content = substr($match, 1); return array( PluginUtility::STATE => $state, PluginUtility::PAYLOAD => $content, ); case DOKU_LEXER_UNMATCHED : return PluginUtility::handleAndReturnUnmatchedData(self::TAG, $match, $handler); } return array(); } public function render($format, Doku_Renderer $renderer, $data): bool { switch ($format) { case "xhtml": /** * @var Doku_Renderer_xhtml $renderer */ $state = $data[PluginUtility::STATE]; switch ($state) { case DOKU_LEXER_ENTER: $renderer->doc .= syntax_plugin_combo_highlightwiki::getOpenTagHighlight(self::TAG) . $data[PluginUtility::PAYLOAD]; return true; case DOKU_LEXER_UNMATCHED: $renderer->doc .= PluginUtility::renderUnmatched($data); return true; case DOKU_LEXER_EXIT: $renderer->doc .= ""; return true; } break; case "metadata": /** * @var Doku_Renderer_metadata $renderer */ $state = $data[PluginUtility::STATE]; switch ($state) { case DOKU_LEXER_ENTER: $renderer->doc .= $data[PluginUtility::PAYLOAD]; return true; case DOKU_LEXER_UNMATCHED: $renderer->doc .= PluginUtility::renderUnmatched($data); } break; } return false; } }