bridge:trumpsuits-dokuwiki-plugin
Verschillen
Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.
| Beide kanten vorige revisieVorige revisieVolgende revisie | Vorige revisie | ||
| bridge:trumpsuits-dokuwiki-plugin [2020/12/19 16:37] – oude revisie hersteld (2020/08/26 22:08) 45.67.212.179 | bridge:trumpsuits-dokuwiki-plugin [2024/03/08 19:45] (huidige) – [Notes] Pieter van der Meulen | ||
|---|---|---|---|
| Regel 1: | Regel 1: | ||
| ====== Trump suits plugin for DokuWiki ====== | ====== Trump suits plugin for DokuWiki ====== | ||
| - | This may not be the most spectacular DokuWiki plugin available, but it suits my own needs just fine. The plugin renders (will render in the near future) the diamond and heart card suit symbols in red, and the clubs and spade card suit symbols in black. It also adds four buttons to the editor toolbar for quick access to the trump suit symbols. | + | This may not be the most spectacular DokuWiki plugin available, but it suits my own needs just fine. The plugin renders (FIXME will render in the near future) the diamond and heart card suit symbols in red, and the clubs and spade card suit symbols in black. It also adds four buttons to the editor toolbar for quick access to the trump suit symbols. |
| - | Due to my very limited knowledge of PHP and javascript I can't guarantee this won't set fire to your DokuWiki server. Mine seems to have survived | + | Due to my very limited knowledge of PHP and javascript I can't guarantee this won't set fire to your DokuWiki server. Mine seems to have survived |
| ===== Syntax ===== | ===== Syntax ===== | ||
| - | No special syntax. Just use standard UTF card suit symbols (optionally inserted | + | No special syntax. Just use standard UTF card suit symbols (optionally inserted |
| ===== Installation ===== | ===== Installation ===== | ||
| - | Point your plug-in manager at [/ | ||
| - | [[http://robmeerman.co.uk/ | + | ==== Plugin manager ==== |
| + | |||
| + | |||
| + | Point your plug-in manager at [[/downloads/trumpsuits-dokuwiki-plugin.tar.gz]] or [[/downloads/trumpsuits-dokuwiki-plugin.zip]]. FIXME | ||
| ==== Manual ==== | ==== Manual ==== | ||
| - | Create the folder '' | + | Create the folder '' |
| + | |||
| + | ^ Suit ^ Filename | ||
| + | | Clubs | ||
| + | | Diamonds | ||
| + | | Hearts | ||
| + | | Spades | ||
| + | |||
| + | |||
| + | === syntax.php === | ||
| + | |||
| + | Take care not to include whitespace in front of the first php tag or after the last php tag. This leads to strange behaviour by DokuWiki. | ||
| + | <code php> | ||
| + | <?php | ||
| + | /** | ||
| + | * Plugin base links: Creates links relative to site root for all links beginning with "/" | ||
| + | * | ||
| + | * @license | ||
| + | * @author | ||
| + | */ | ||
| + | |||
| + | if(!defined(' | ||
| + | if(!defined(' | ||
| + | require_once(DOKU_PLUGIN.' | ||
| + | |||
| + | /** | ||
| + | * All DokuWiki plugins to extend the parser/ | ||
| + | * need to inherit from this class | ||
| + | */ | ||
| + | class syntax_plugin_trumpsuits extends DokuWiki_Syntax_Plugin { | ||
| + | |||
| + | /** | ||
| + | * return some info | ||
| + | */ | ||
| + | function getInfo(){ | ||
| + | return array( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * What kind of syntax are we? | ||
| + | */ | ||
| + | function getType(){ | ||
| + | return ' | ||
| + | } | ||
| + | |||
| + | //This must be implemented | ||
| + | function getSort(){ return 123; } | ||
| + | |||
| + | |||
| + | } | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | Hieruit eventueel nog stukje gebruiken: | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | /** | ||
| + | * Plugin Trumpsigns: Inserts <font size=" | ||
| + | * | ||
| + | * @license | ||
| + | * @author | ||
| + | */ | ||
| + | |||
| + | if(!defined(' | ||
| + | if(!defined(' | ||
| + | require_once(DOKU_PLUGIN.' | ||
| + | |||
| + | /** | ||
| + | * All DokuWiki plugins to extend the parser/ | ||
| + | * need to inherit from this class | ||
| + | */ | ||
| + | class syntax_plugin_tab extends DokuWiki_Syntax_Plugin { | ||
| + | |||
| + | /** | ||
| + | * return some info | ||
| + | */ | ||
| + | function getInfo(){ | ||
| + | return array( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * What kind of syntax are we? | ||
| + | */ | ||
| + | function getType(){ | ||
| + | return ' | ||
| + | } | ||
| + | |||
| + | |||
| + | /** | ||
| + | * Where to sort in? | ||
| + | */ | ||
| + | function getSort(){ | ||
| + | return 789; | ||
| + | } | ||
| + | |||
| + | |||
| + | /** | ||
| + | * Connect pattern to lexer | ||
| + | */ | ||
| + | function connectTo($mode) { | ||
| + | $this-> | ||
| + | $this-> | ||
| + | $this-> | ||
| + | $this-> | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * Handle the match | ||
| + | */ | ||
| + | function handle($match, | ||
| + | switch ($state) { | ||
| + | case DOKU_LEXER_ENTER : | ||
| + | break; | ||
| + | case DOKU_LEXER_MATCHED : | ||
| + | break; | ||
| + | case DOKU_LEXER_UNMATCHED : | ||
| + | break; | ||
| + | case DOKU_LEXER_EXIT : | ||
| + | break; | ||
| + | case DOKU_LEXER_SPECIAL : | ||
| + | break; | ||
| + | } | ||
| + | return array(); | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * Create output | ||
| + | */ | ||
| + | function render($mode, | ||
| + | if($mode == ' | ||
| + | $renderer-> | ||
| + | $renderer-> | ||
| + | $renderer-> | ||
| + | return true; | ||
| + | } | ||
| + | return false; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | //Setup VIM: ex: et ts=4 enc=utf-8 : | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | === script.js === | ||
| + | |||
| + | <code javascript> | ||
| + | //create a single toolbutton with desired properties | ||
| + | function plugin_trumpsuits_createToolbutton (id, tooltipText, | ||
| + | var ico = document.createElement(" | ||
| + | ico.src = DOKU_BASE + " | ||
| + | var btn = document.createElement(" | ||
| + | btn.id = " | ||
| + | btn.className = " | ||
| + | btn.appendChild(ico); | ||
| + | btn.title = tooltipText; | ||
| + | btn.accessKey = accKey; | ||
| + | eval(' | ||
| + | return(btn); | ||
| + | } | ||
| + | |||
| + | //if this is an " | ||
| + | function plugin_trumpsuits_toolbar_additions() { | ||
| + | var toolbar = $(" | ||
| + | if(!toolbar) {return;} | ||
| + | if(!$(" | ||
| + | var tbtn = plugin_trumpsuits_createToolbutton(" | ||
| + | if (tbtn) {toolbar.appendChild(tbtn); | ||
| + | tbtn = plugin_trumpsigns_createToolbutton(" | ||
| + | if (tbtn) {toolbar.appendChild(tbtn); | ||
| + | tbtn = plugin_trumpsigns_createToolbutton(" | ||
| + | if (tbtn) {toolbar.appendChild(tbtn); | ||
| + | tbtn = plugin_trumpsigns_createToolbutton(" | ||
| + | if (tbtn) {toolbar.appendChild(tbtn); | ||
| + | } | ||
| + | |||
| + | addInitEvent(plugin_trumpsuits_toolbar_additions); | ||
| + | </ | ||
| + | ===== Notes ===== | ||
| + | |||
| + | Notes on javasript in plugins: http:// | ||
| + | |||
| + | Browser an OS dependent CSS selectors: https:// | ||
bridge/trumpsuits-dokuwiki-plugin.1608392268.txt.gz · Laatst gewijzigd: (Externe bewerking)
