3 if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__
).'/../../').'/');
4 if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC
.'lib/plugins/');
5 require_once(DOKU_PLUGIN
.'syntax.php');
8 * All DokuWiki plugins to extend the parser/rendering mechanism
9 * need to inherit from this class
11 class syntax_plugin_skill
extends DokuWiki_Syntax_Plugin
{
19 'email' => 'iDo@woow-fr.com',
20 'date' => '13/10/2005',
21 'name' => 'Skill Plugin',
22 'desc' => 'Add the possibility to show skill level',
23 'url' => 'http://www.dokuwiki.org/plugin:skill',
28 * What kind of syntax are we?
42 * Connect pattern to lexer
44 function connectTo($mode) {
45 $this->Lexer
->addSpecialPattern("{{skill>[0-9]*/?[0-9]*}}",$mode,'plugin_skill');
51 function handle($match, $state, $pos, &$handler){
52 $match = substr($match,8,-2); // Strip markup
53 $match=split('/',$match); // Strip size
55 if (!isset($match[1])) $match[1] = $match[0];
56 if ($match[0]>$match[1]) $match[1]=$match[0];
63 function render($mode, &$renderer, $data) {
65 $renderer->doc
.= '<span>';
66 $renderer->doc
.= $this->_Skill($data);
67 $renderer->doc
.= '</span>';
75 for($i=1;$i<=$d[0];$i++
) {
76 $mRet.='<img src="lib/plugins/skill/star.png" alt="." style="" />';
78 for($i=1;$i<=($d[1]-$d[0]);$i++
) {
79 $mRet.='<img src="lib/plugins/skill/star.png" alt="." style="filter:alpha(opacity=40);-moz-opacity:0.4;opacity: 0.4;" />';
86 //Setup VIM: ex: et ts=4 enc=utf-8 :