Lexer->addEntryPattern($pattern, $mode, 'plugin_' . webcomponent::PLUGIN_NAME . '_' . $this->getPluginComponent()); } function postConnect() { $this->Lexer->addExitPattern('', 'plugin_' . webcomponent::PLUGIN_NAME . '_' . $this->getPluginComponent()); } function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER : $match = utf8_substr($match, strlen($this->getPluginComponent()) + 1, -1); $parameters = webcomponent::parseMatch($match); return array($state, $parameters); case DOKU_LEXER_UNMATCHED : return array ($state, $match); case DOKU_LEXER_EXIT : // Important otherwise we don't get an exit in the render return array($state, ''); } return array(); } function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ list($state, $parameters) = $data; switch ($state) { case DOKU_LEXER_ENTER : $renderer->doc .= 'doc .= $title; $class = ' class="navbar-brand'; if (array_key_exists("class", $parameters)) { $class .= ' '.$parameters["class"]; } $class .='"'; $renderer->doc .= $class.'>'; break; case DOKU_LEXER_UNMATCHED : // What about: // * the title of the website ? $conf['title'] // * the logo ? $logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), false, $logoSize); $renderer->doc .= $renderer->_xmlEntities($parameters); break; case DOKU_LEXER_EXIT : $renderer->doc .= ''; break; } return true; } // unsupported $mode return false; } public static function getTag() { list(/* $t */, /* $p */, /* $n */, $c) = explode('_', get_called_class(), 4); return (isset($c) ? $c : ''); } }