Changeset 30312 for documentation

Show
Ignore:
Timestamp:
04.11.2015 15:14:22 (3 years ago)
Author:
jmt12
Message:

Match and hide any HTML comments that appear within a TABAREA block

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • documentation/trunk/wiki/plugins/simpletabs/syntax.php

    r30114 r30312  
    133133    $this->Lexer->addPattern('<TAB>', 'plugin_simpletabs'); 
    134134    $this->Lexer->addPattern('</TAB>', 'plugin_simpletabs'); 
     135    // Hide comments always (sometimes used as separator) 
     136    $this->Lexer->addPattern('<!--.*?-->', 'plugin_simpletabs'); 
    135137    // Special things inside the content we want to manually handle. 
    136138    $this->Lexer->addPattern( '^[ \t]*={2,6}\s?[^\n]+={2,6}[ \t]*(?=\n)', 'plugin_simpletabs'); 
     
    230232                                   'bytepos' => $pos + strlen($match))); 
    231233      } 
     234      if (preg_match('/<!--(.*)?-->/s', $match, $matches)) 
     235      { 
     236          $this->_debugPrint("Handler=>comment: " . htmlspecialchars($matches[1])); 
     237          $params = array(); 
     238          $params['action'] = 'comment'; 
     239          $params['comment'] = $matches[1]; 
     240          return array($state, $params); 
     241      } 
    232242      if (preg_match('/(={2,6})\s*(.+?)\s*={2,6}/', $match, $matches)) 
    233243      { 
     
    249259 
    250260    case DOKU_LEXER_UNMATCHED: 
    251         $this->_debugPrint("Handler=>unmatched: " . $match); 
     261        $this->_debugPrint("Handler=>unmatched: " . htmlspecialchars($match)); 
    252262      return array($state, $match); 
    253263      break; 
     
    313323              if ($this->divide_edit_section && method_exists($renderer, 'startSectionEdit')) 
    314324              { 
    315                   $extra_classy = $renderer->startSectionEdit($params['bytepos'], 'plugin_simpletabs'); 
     325                  $extra_classy = ' ' . $renderer->startSectionEdit($params['bytepos'], 'plugin_simpletabs'); 
    316326              } 
    317               $renderer->doc .= '  <div id="simpletabs-tc' . $params['tab_area_id'] . '_' . $params['tab_number'] . '" class="tab ' . $extra_classy . '" '; 
     327              $renderer->doc .= '  <div id="simpletabs-tc' . $params['tab_area_id'] . '_' . $params['tab_number'] . '" class="tab' . $extra_classy . '"'; 
    318328              if (!$params['active']) 
    319329              { 
     
    332342              $renderer->doc .= '</div>'; 
    333343              break; 
     344          case 'comment': 
     345              $renderer->doc .= '<!-- ' . $params['comment'] . ' -->'; 
     346              break; 
    334347          case 'heading': 
    335348              $renderer->doc .= '<h' . $params['level'] . '>' . $params['title'] . '</h' . $params['level'] . '>';