This is an old revision of the document!
Table of Contents
jira plugin
Compatible with DokuWiki
No compatibility info given!
The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Download and Installation
Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.
Update your host and project keys in the syntax.php.
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
.
- syntax.php
<?php /** * Plugin jira: Creates links into JIRA from JIRA IDs. * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Robert Lopuszanski <rlop@gmx.de> */ 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 .= '(<a href="http://host/browse/' . $data[0] . '" >' . $data[0] . '</a>)'; } return true; } } ?>
Discussion
Similar results can be achieved using a custom interwiki link without installing any plugin.