'Jonas Berg', 'email' => 'jonas.s.berg@home.se', 'date' => '2012-03-28', 'name' => 'chiplink plugin', 'desc' => 'Provides automatic links to HTML reports on your server, by searching the wikitext.', 'url' => 'http://www.dokuwiki.org/plugin:chiplink', ); } public function getType(){ return 'substition'; } public function getSort(){ return 920; } /** * Search for the pattern */ public function connectTo($mode) { $this->Lexer->addSpecialPattern('[sS][wW][0-9]+[pP][0-9]+', $mode, 'plugin_chiplink'); // For example 'SW1613p8' } /** * Read the information from the matched wiki text */ public function handle($match, $state, $pos, &$handler){ $stripped = substr($match, 2); // Remove initial 'SW' $splitted = preg_split("/[pP]/", $stripped); // Split '1613p8' into '1613' and '8'. list($wafer, $chip) = $splitted; return array($wafer, $chip); } /** * Generate HTML output */ public function render($mode, &$renderer, $data) { if($mode != 'xhtml'){ return false; } list($wafer, $chip) = $data; $relativelocation = $this->getConf('relativelocation'); $url = "/".$relativelocation."/"."SW".$wafer.".htm#p".$chip; // Relative link, servername is not necessary. $description = "SW".$wafer."p".$chip; $renderer->doc .= "".$description.""; return true; } } // vim:ts=4:sw=4:et: