/**
  * We don't want <h1> in our text
  *
  * @param $line
  * @return array|null|void
  */
 protected function blockHeader($line)
 {
     $block = parent::blockHeader($line);
     if ($block && isset($block['element'])) {
         if ($block['element']['name'] == 'h1') {
             return null;
         }
     }
     return $block;
 }
 protected function blockHeader($Line)
 {
     $Block = parent::blockHeader($Line);
     if (preg_match('/[ #]*{(' . $this->regexAttribute . '+)}[ ]*$/', $Block['element']['text'], $matches, PREG_OFFSET_CAPTURE)) {
         $attributeString = $matches[1][0];
         $Block['element']['attributes'] = $this->attributeData($attributeString);
         $Block['element']['text'] = substr($Block['element']['text'], 0, $matches[0][1]);
     }
     return $Block;
 }
Exemple #3
0
 protected function blockHeader($line)
 {
     return $this->addHeaderInToc(parent::blockHeader($line));
 }
Exemple #4
0
 protected function blockHeader($Line)
 {
     $e = parent::blockHeader($Line);
     $text = $e['element']['name'];
     // 注释中的标题降两级,并添加题标数
     if (preg_match('/h(\\d+)/', $text, $ms)) {
         $level = (int) $ms[1];
         $titleNum = $this->getTitleNum($level);
         $elem =& $e['element'];
         $elem['name'] = "h" . ($level + 2);
         $txt = $titleNum . " " . $elem['text'];
         $elem['text'] = $txt;
         global $options;
         if ($options['subtoc']) {
             if (!isset($elem['attributes'])) {
                 $elem['attributes'] = [];
             }
             global $curBlockId, $subTitles;
             $elem['attributes']['id'] = subTocId($curBlockId, $txt);
             $subTitles[] = $txt;
         }
     }
     return $e;
 }