Lexer->addEntryPattern($pattern, $mode, PluginUtility::getModeFromTag($this->getPluginComponent())); } function postConnect() { $this->Lexer->addExitPattern('', PluginUtility::getModeFromTag($this->getPluginComponent())); } function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER : $tagAttributes = TagAttributes::createFromTagMatch($match); return array( PluginUtility::STATE => $state, PluginUtility::ATTRIBUTES => $tagAttributes->toCallStackArray() ); case DOKU_LEXER_UNMATCHED : /** * We should not have anything here * but in any case, we send the data for feedback */ return PluginUtility::handleAndReturnUnmatchedData(self::TAG, $match, $handler); case DOKU_LEXER_EXIT : /** * Return state to keep the call stack structure * and print the closing tag */ 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) { if ($format == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ $state = $data[PluginUtility::STATE]; switch ($state) { case DOKU_LEXER_ENTER: $tagAttributes = TagAttributes::createFromCallStackArray($data[PluginUtility::ATTRIBUTES]); $tagAttributes->addClassName(self::TAG); $renderer->doc .= $tagAttributes->toHtmlEnterTag("div"); break; case DOKU_LEXER_EXIT: $renderer->doc .= ""; break; case DOKU_LEXER_UNMATCHED: /** * In case anyone put text where it should not */ $renderer->doc .= PluginUtility::renderUnmatched($data); break; } return true; } // unsupported $mode return false; } }