Modification of <tab> plugin

Enhancement/Feature Extension 2011-09-22 by Taggic
plugin download: tab_modified.zip

If you modify the code according below you can define the quantity of ”&nbsp” signs. If the parameter is missing it is using automatically the old behaiviour so that nobody has to search through all pages and replace the formerly used “tabs”.

following both syntax lines are working:

<tab> 5 times "&nbsp;" as before
<tab2> 2 times "&nbsp;" (where 2 can be each positive integer value, a negative value will be ignored)

Code Modification

    // Connect pattern to lexer
    function connectTo($mode) { 
      $this->Lexer->addSpecialPattern('<tab\d*>', $mode, 'plugin_tab'); }
 
    // Handle the match
    function handle($match, $state, $pos, &$handler){
        $match = substr($match,4,-1);             //strip markup from start and end
 
        if ((strlen($match)>0) && ($match >0)) {  // add as many space as defined if value is positive
            $data .= str_repeat('&#160;', $match);
        }
        else {                                    // if standard tab is used then insert 5 spaces
          $data = '&#160;&#160;&#160;&#160;&#160;';                        
        }
        return $data;
    }
tips/tips_tab.txt · Last modified: 2014/04/30 09:36 (external edit)

This Wiki is hosted and ruled by Policies of Frister Consultancy Services.
By using this wiki you accept these rules. -> Impressum