Lexer->addEntryPattern($pattern, $mode, 'plugin_' . webcomponent::PLUGIN_NAME . '_' . $this->getPluginComponent()); } public function postConnect() { // We define the DOKU_LEXER_EXIT state $this->Lexer->addExitPattern('' . self::getElementName() . '>', 'plugin_' . webcomponent::PLUGIN_NAME . '_' . $this->getPluginComponent()); } /** * Handle the match * You get the match for each pattern in the $match variable * $state says if it's an entry, exit or match pattern * * This is an instruction block and is cached apart from the rendering output * There is two caches levels * This cache may be suppressed with the url parameters ?purge=true */ public function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER : // Suppress the tag name $match = utf8_substr($match, strlen(self::getTag()) + 1, -1); $parameters = webcomponent::parseMatch($match); return array($state, $parameters); break; case DOKU_LEXER_UNMATCHED : // // The nested authorized plugin are given in the function // getAllowedTypes // // cdata means normal text ??? See xhtml.php function cdata // What it does exactly, I don't know // but as we want to process the content // we need to add a call to the lexer to go further // Comes from the wrap plugin $handler->_addCall('cdata', array($match), $pos, null); break; case DOKU_LEXER_EXIT: return array($state, ''); break; } } /** * Create output * The rendering process * @param string $mode * @param Doku_Renderer $renderer * @param array $data * @return bool */ public function render($mode, Doku_Renderer $renderer, $data) { // The $data variable comes from the handle() function // // $mode = 'xhtml' means that we output html // There is other mode such as metadata, odt if ($mode == 'xhtml') { /** * To help the parser recognize that _xmlEntities is a function of Doku_Renderer_xhtml * and not of Doku_Renderer * * @var Doku_Renderer_xhtml $renderer */ list($state, $parameters) = $data; switch ($state) { case DOKU_LEXER_ENTER : $renderer->doc .= '