*/ class syntax_plugin_mizarverifiabledocs extends \dokuwiki\Extension\SyntaxPlugin { /** @inheritDoc */ public function getType() { return 'substition'; } /** @inheritDoc */ public function getPType() { return 'block'; } /** @inheritDoc */ public function getSort() { return 195; } /** @inheritDoc */ public function connectTo($mode) { $this->Lexer->addSpecialPattern(']+>.*?', $mode, 'plugin_mizarverifiabledocs'); } public function handle($match, $state, $pos, Doku_Handler $handler) { preg_match('/]+)>(.*?)<\/mizar>/s', $match, $matches); $filename = htmlspecialchars(trim($matches[1])); $content = htmlspecialchars(trim($matches[2])); return array($state, $filename, $content); } public function render($mode, Doku_Renderer $renderer, $data) { static $mizarCounter = 0; // 一意のカウンターを追加 list($state,$filename, $content) = $data; $mizarId = 'mizarBlock' . $mizarCounter++; // 一意のIDを生成 if ($mode == 'xhtml') { // ボタンやエディタのHTMLを生成 $renderer->doc .= '
'; $renderer->doc .= '
'; $renderer->doc .= ''; $renderer->doc .= ''; $renderer->doc .= ''; $renderer->doc .= ''; $renderer->doc .= '
' . $filename . '
'; $renderer->doc .= '
'; $renderer->doc .= '
'; $renderer->doc .= '
'; $renderer->doc .= ''; $renderer->doc .= '
'; } else { $renderer->doc .= "$content"; } return true; } }