jmolDir = DOKU_BASE.$sl.'lib/plugins/jmol2/jmol/'; $this->jmolJS = $this->jmolDir.'Jmol.js'; } function getInfo(){ return array( 'author' => 'Luigi Micco', 'email' => 'l.micco@tiscali.it', 'date' => '2010-02-15', 'name' => 'Jmol2 Plugin', 'desc' => 'Parses jmol-blocks ... script ...', 'url' => 'http://www.bitlibero.com/dokuwiki/jmol2.zip',); } function getType(){ return 'protected'; } function getSort(){ return 815; } function connectTo($mode){ $this->Lexer->addEntryPattern('(?=.*?)',$mode,'plugin_jmol2'); } function postConnect(){ $this->Lexer->addExitPattern('','plugin_jmol2'); } // Handling lexer function handle($match, $state, $pos) { switch ($state){ case DOKU_LEXER_ENTER : list($pdbname,$width,$height,$background) = explode(" ", substr($match, 2+4, -1)); return array($state, array($pdbname,$width,$height,$background)); case DOKU_LEXER_UNMATCHED : return array($state, $match); case DOKU_LEXER_EXIT : return array($state, ''); } return array(); } /** * Render Jmol applet */ function render($mode, &$renderer, $data){ if($mode != 'xhtml') return false; global $conf; @list($state, $match) = $data; switch ($state){ case DOKU_LEXER_ENTER : list($pdbname,$width,$height,$background) = $match; if (!empty($pdbname)) { $width = empty($width)?300:urlencode($width); $height = empty($height)?$width:urlencode($height); $background = empty($background)?"#ffffff":$background; $pdbname = preg_replace("/{{([^|}]+).*}}/","$1",$pdbname); if ($pdbname != ".") { $pdbFileLink = ml($pdbname); } $renderer->doc .= '
'; $renderer->doc .= '
'; break; } } } ?>