plugin:tab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:tab [2011-09-22 12:00] – [Enhancement/Feature Extension] 93.199.162.152 | plugin:tab [2020-05-14 22:36] (current) – [Tab Plugin] Juergen_aus_Zuendorf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tab ====== | + | ====== Tab Plugin |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
- | author | + | author |
- | email : timskoch@hotmail.com | + | email : H-J-Schuemmer@Web.de |
type : syntax | type : syntax | ||
- | lastupdate : 2006-08-16 | + | 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 : | + | |
- | </code> | + | There are two ways to use the plugin: |
+ | - Insert '' | ||
+ | - Insert ''< | ||
- | ===== Installation ===== | + | Therefore the following both syntax lines are working: |
- | Just like any other plugin: | + | ^ Syntax |
+ | | ''< | ||
+ | | ''< | ||
- | Enjoy! | ||
+ | ===== Installation ===== | ||
+ | Install the plugin using the [[plugin: | ||
- | ===== Discussion ===== | ||
- | Is any really necessary? ;-) | + | ===== Development ===== |
- | ====== | + | The original code was written by Tim Skoch. I have updated it for compatibility to PHP7 and included the possibility proposed by taggic (2011-09-22) to extend the syntax to "< |
- | Tim, | + | |
- | We used your code to spawn our [[plugin:pagebreak|pagebreak]] plugin. | + | The earlier description can be found [[.:tab:old|here]]. |
- | ~[[mailto: | + | |
- | ---- | ||
- | 2010-05-18 | + | === Change Log === |
- | :?: It doesn' | + | |
- | ==== New Code ==== | + | |
- | Could be done in less lines (drop test code etc). | + | * **2018-02-06**: |
- | <code php> | + | * **2020-05-14**: |
- | <?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 ' | ||
- | } | ||
- | |||
- | /** | ||
- | * Where to sort in? | ||
- | | ||
- | function getSort(){ | ||
- | return 999; | ||
- | } | ||
- | |||
- | /** | ||
- | * Connect pattern to lexer | ||
- | */ | ||
- | function connectTo($mode) { | ||
- | $this-> | ||
- | } | ||
- | |||
- | /** | ||
- | * Handle the match | ||
- | */ | ||
- | function handle($match, | ||
- | return array(); | ||
- | } | ||
- | |||
- | /** | ||
- | * Create output | ||
- | */ | ||
- | function render($mode, | ||
- | if($mode == ' | ||
- | $renderer-> | ||
- | return true; | ||
- | } | ||
- | return false; | ||
- | } | ||
- | } | ||
- | ?> | + | === Known Bugs and Issues === |
- | </ | + | |
- | When we updated to the latest version of DokuWiki, this broke. It failed to interpret "& | + | Please report bugs or feature requests at the [[https:// |
- | 2011-07-26 | ||
- | Works great in latest version using "New Code" above. | ||
- | ---- | + | ===== Discussion ===== |
- | + | ||
- | ==== Enhancement/ | + | |
- | // | + | |
- | + | ||
- | 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.1316685654.txt.gz · Last modified: 2011-09-22 12:00 by 93.199.162.152