====== jira Plugin ====== ---- plugin ---- description: Create links to JIRA tracker from JIRA IDs author : Robert Lopuszanski email : rlop_@_gmx.de type : Syntax lastupdate : 2009-09-02 compatible : depends : conflicts : similar : tags : links, management, embed downloadurl: http://rlopuszanski.gmxhome.de/dokuwiki/jira.zip ---- ===== Download and Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. * http://rlopuszanski.gmxhome.de/dokuwiki/jira.zip Update your host and project keys in the syntax.php. Has been tested successfully with Release 2011-05-25a "Rincewind" ===== Usage ===== Adds a link into your JIRA tracker for (KEY1-123), where KEY1 is a JIRA project key. ===== Plugin ===== Create a new folder ''lib/plugins/jira/'' and place the following file in it: ''syntax.php''. */ 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/plugin:jira', ); } /** * 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] . ')'; } else { $renderer->doc .= $data[0]; } return true; } } ?> ===== Discussion ===== Similar results can be achieved using a custom [[:interwiki]] link without installing any plugin.