*/ if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_youtracklinks extends DokuWiki_Syntax_Plugin { /** * Get the type of syntax this plugin defines. * * @param none * @return String 'substition' (i.e. 'substitution'). * @public * @static */ function getType(){ return 'substition'; } /** * Where to sort in? * * @param none * @return Integer 6. * @public * @static */ function getSort(){ return 6; } /** * Connect lookup pattern to lexer. * * @param $aMode String The desired rendermode. * @return none * @public * @see render() */ function connectTo($mode) { $this->Lexer->addSpecialPattern('\b[A-Z]+[\-][0-9]+\b', $mode, 'plugin_youtracklinks'); } /** * Handler to prepare matched data for the rendering process. * *
* The $aState parameter gives the type of pattern * which triggered the call to this method: *
** The method checks for the given $aFormat and returns * FALSE when a format isn't supported. $aRenderer * contains a reference to the renderer object which is currently * handling the rendering. The contents of $aData is the * return value of the handle() method. *
* @param $aFormat String The output format to generate. * @param $aRenderer Object A reference to the renderer object. * @param $aData Array The data created by the handle() * method. * @return Boolean TRUE if rendered successfully, or * FALSE otherwise. * @public * @see handle() */ function render($mode, &$renderer, $data) { if ($mode == 'xhtml') { if (array_key_exists('link', $data)) { $renderer->doc .= $data['link']; return true; } } // rerender match, because no link was generated if (array_key_exists('match', $data)) { $renderer->doc .= $data['match']; return true; } return false; } }