Lexer->addSpecialPattern('\{\{infobox>.*?\}\}', $mode, 'plugin_infobox'); } public function handle($match, $state, $pos, Doku_Handler $handler) { $data = substr($match, 10, -2); $lines = explode("\n", $data); $params = []; foreach ($lines as $line) { $line = trim($line); if (strpos($line, '=') !== false) { list($key, $value) = explode('=', $line, 2); $params[trim($key)] = trim($value); } } return $params; } public function render($mode, Doku_Renderer $renderer, $data) { if ($mode != 'xhtml') return false; $renderer->doc .= '
'; if (isset($data['name'])) { $renderer->doc .= '
' . $this->_parseWikiText($data['name']) . '
'; } if (isset($data['image'])) { $renderer->doc .= '
' . hsc($data['name']) . '
'; } $renderer->doc .= ''; foreach ($data as $key => $value) { if ($key != 'name' && $key != 'image') { $renderer->doc .= ''; } } $renderer->doc .= '
' . hsc($key) . '' . $this->_parseWikiText($value) . '
'; $renderer->doc .= '
'; return true; } private function _parseWikiText($text) { $info = array(); $xhtml = p_render('xhtml', p_get_instructions($text), $info); return $xhtml; } }