plugin:tab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:tab [2018-02-06 16:29] – Juergen_aus_Zuendorf | plugin:tab [2020-05-14 22:36] (current) – [Tab Plugin] Juergen_aus_Zuendorf | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
- | author | + | author |
- | email : timskoch@hotmail.com | + | email : H-J-Schuemmer@Web.de |
type : syntax | type : syntax | ||
- | lastupdate : 2018-02-06 | + | lastupdate : 2020-05-14 |
- | compatible : | + | compatible : 2018-04-22b " |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
tags : typography | tags : typography | ||
+ | |||
+ | downloadurl: | ||
+ | bugtracker : https:// | ||
+ | sourcerepo : https:// | ||
---- | ---- | ||
Line 17: | Line 21: | ||
===== Description ===== | ===== Description ===== | ||
- | Nothing too special. | + | Since one can't really do tabs in HTML, this plugin offers a possibility by the use of non-breaking spaces (nbsp' |
- | ===== Use ===== | ||
- | Simply insert '< | + | ===== Syntax |
- | + | ||
- | ===== Code ===== | + | |
- | <code php lib/ | + | |
- | <?php | + | |
- | /** | + | |
- | * Plugin Tab: Inserts "& | + | |
- | * | + | |
- | * @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 ' | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * What kind of syntax do we allow (optional) | + | |
- | */ | + | |
- | // function getAllowedTypes() { | + | |
- | // return array(); | + | |
- | // } | + | |
- | + | ||
- | /** | + | |
- | * What about paragraphs? (optional) | + | |
- | */ | + | |
- | // function getPType(){ | + | |
- | // return ' | + | |
- | // } | + | |
- | + | ||
- | /** | + | |
- | * Where to sort in? | + | |
- | */ | + | |
- | function getSort(){ | + | |
- | return 999; | + | |
- | } | + | |
- | + | ||
- | + | ||
- | /** | + | |
- | * Connect pattern to lexer | + | |
- | */ | + | |
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | // $this-> | + | |
- | } | + | |
- | + | ||
- | // function postConnect() { | + | |
- | // $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-> | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | //Setup VIM: ex: et ts=4 enc=utf-8 : | + | |
- | </ | + | |
- | --- [[user>Juergen_aus_Zuendorf|Juergen_aus_Zuendorf]] // | + | There are two ways to use the plugin: |
- | -> Changes for PHP7: \\ "& | + | |
- | ===== Installation ===== | + | - Insert ''< |
- | Just like any other plugin: | + | Therefore |
- | Enjoy! | + | ^ Syntax |
+ | | ''< | ||
+ | | ''< | ||
+ | ===== Installation ===== | ||
- | ===== Discussion ===== | + | Install the plugin using the [[plugin: |
- | Is any really necessary? ;-) | ||
- | ====== | + | ===== Development |
- | Tim, | + | |
- | We used your code to spawn our [[plugin: | + | The original |
- | ~[[mailto: | + | |
- | ---- | + | The earlier description can be found [[.: |
- | 2010-05-18 | ||
- | :?: It doesn' | ||
- | ==== New Code ==== | ||
- | Could be done in less lines (drop test code etc). | + | === Change Log === |
- | <code php> | + | |
- | <?php | + | |
- | /** | + | |
- | * Plugin Tab: Inserts "& | + | * **2020-05-14**: Acquisition and updating by Juergen |
- | * | + | |
- | * @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 999; | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Connect pattern to lexer | + | |
- | */ | + | |
- | function connectTo($mode) { | + | |
- | $this->Lexer-> | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Handle the match | + | |
- | */ | + | |
- | function handle($match, | + | |
- | return array(); | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Create output | + | |
- | */ | + | |
- | function render($mode, | + | |
- | if($mode == ' | + | |
- | $renderer-> | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | } | + | |
- | ?> | ||
- | </ | ||
- | When we updated to the latest version of DokuWiki, this broke. | + | === Known Bugs and Issues === |
- | 2011-07-26 | + | Please report bugs or feature requests at the [[https:// |
- | Works great in latest version using "New Code" above. | + | |
- | ---- | ||
- | ==== Enhancement/ | + | ===== Discussion ===== |
- | // | + | |
- | + | ||
- | If you modify the code according below you can define the quantity of "& | + | |
- | + | ||
- | following both syntax lines are working: | + | |
- | < | + | |
- | <tab> 5 times "& | + | |
- | < | + | |
- | </ | + | |
- | <code php> | ||
- | // Connect pattern to lexer | ||
- | function connectTo($mode) { | ||
- | $this-> | ||
- | |||
- | // Handle the match | ||
- | function handle($match, | ||
- | $match = substr($match, | ||
- | | ||
- | if ((strlen($match)> | ||
- | $data .= str_repeat('&# | ||
- | } | ||
- | else { // if standard tab is used then insert 5 spaces | ||
- | $data = '&# | ||
- | } | ||
- | return $data; | ||
- | } | ||
- | // Create output | ||
- | function render($mode, | ||
- | if($mode == ' | ||
- | $renderer-> | ||
- | return true; } | ||
- | return false; | ||
- | } | ||
- | </ |
plugin/tab.1517930958.txt.gz · Last modified: 2018-02-06 16:29 by Juergen_aus_Zuendorf