*/ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_jira extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Robert Lopuszanski', 'email' => 'rlop@gmx.de', 'date' => '2009-09-02', 'name' => 'JIRA plugin', 'desc' => 'Creates links into JIRA from JIRA ids', 'url' => 'http://www.dokuwiki.org/plugins', ); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } function getSort(){ return 359; } function connectTo($mode) { $projectKeys = array('KEY1', 'KEY2'); foreach($projectKeys as $key) { $this->Lexer->addSpecialPattern('\(' . $key . '-\d+\)',$mode,'plugin_jira'); } } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ return array( substr( $match, 1, strlen($match) - 2 )); } /** * Create output */ function render($format, &$renderer, $data) { if($format == 'xhtml'){ $renderer->doc .= '(' . $data[0] . ')'; } return true; } } ?>