Lexer->addEntryPattern('(?=.*)',$mode,'plugin_dtable'); } function postConnect() { $this->Lexer->addExitPattern('','plugin_dtable'); } function handle($match, $state, $pos, Doku_Handler $handler) { global $INFO; switch ($state) { case DOKU_LEXER_ENTER : try { $table_nr = (int) substr($match, 5, 2); return array($state, array($pos, $table_nr, p_get_metadata($INFO['id'], 'dtable_pages'))); } catch(Exception $e) { return array($state, false); } case DOKU_LEXER_UNMATCHED : return array($state, $match); case DOKU_LEXER_EXIT : return array($state, ''); } return array(); } function render($mode, Doku_Renderer $renderer, $data) { global $ID; if($mode == 'xhtml') { list($state,$match) = $data; switch ($state) { case DOKU_LEXER_ENTER : if($match != false) { if (auth_quickaclcheck($ID) >= AUTH_EDIT) { $dtable =& plugin_load('helper', 'dtable'); $pos = $match[0]; $table_nr = $match[1]; $dtable_pages = $match[2]; $id = $dtable_pages[$table_nr]; $filepath = wikiFN( $id ); $start_line = $dtable->line_nr($pos, $filepath) ; //search for first row $file_cont = explode("\n", io_readWikiPage($filepath, $id)); $start_line++; $i = $start_line; while( $i < count($file_cont) && strpos($file_cont[$i], '|') !== 0 && strpos($file_cont[$i], '^') !== 0) $i += 1; $start_line = $i; $raw_lines = ''; while( $i < count($file_cont) && strpos( $file_cont[ $i ], '' ) !== 0 ) { $raw_lines .= $file_cont[$i]."\n"; $i++; } $lines = $dtable->rows($raw_lines, $id, $start_line); $json = new JSON(); $renderer->doc .= '
'; $renderer->doc .= ''; //This is needed to correct linkwiz behaviour. $renderer->doc .= ''; } } break; case DOKU_LEXER_UNMATCHED : $renderer->doc .= $renderer->_xmlEntities($match); break; case DOKU_LEXER_EXIT : if (auth_quickaclcheck($ID) >= AUTH_EDIT) $renderer->doc .= "
"; break; } return true; } return false; } }