Lexer->addEntryPattern('\',$mode,'plugin_dirtylittlehelper_'.$this->getPluginComponent()); } public function postConnect() { $this->Lexer->addExitPattern('\<\/dlh\.mm\>','plugin_dirtylittlehelper_'.$this->getPluginComponent()); } /** * Handle matches of the DLH syntax * * @param string $match The match of the syntax * @param int $state The state of the handler * @param int $pos The position in the document * @param Doku_Handler $handler The handler * * @return array Data for the renderer */ public function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER: if($match==''){ return array($state, 'MERMAID',$match); } case DOKU_LEXER_UNMATCHED : return array($state, 'UNMATCHED', $match); case DOKU_LEXER_EXIT : if($match==''){ return array($state, '/MERMAID',$match); } } return false; } //handle /** * Render xhtml output or metadata * * @param string $mode Renderer mode (supported modes: xhtml) * @param Doku_Renderer $renderer The renderer * @param array $data The data from the handler() function * * @return bool If rendering was successful. */ public function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { if($data[1]=='MERMAID'){ // securityLevel loose allows more advanced functionality such as subgraphs to run. // @todo: this should be an option in the interface. $renderer->doc .= '
'; return true; }elseif($data[1]=='/MERMAID'){ $renderer->doc .= "
"; return true; }elseif($data[1]=='UNMATCHED'){ $renderer->doc .= $data[2]; return true; } return false; } //mode xhtml return false; } //function render } //class