当前位置: 首页>>代码示例>>PHP>>正文


PHP ParserOutput::setTOCEnabled方法代码示例

本文整理汇总了PHP中ParserOutput::setTOCEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::setTOCEnabled方法的具体用法?PHP ParserOutput::setTOCEnabled怎么用?PHP ParserOutput::setTOCEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParserOutput的用法示例。


在下文中一共展示了ParserOutput::setTOCEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extractWikitextParts

 /**
  * Extract parts of the text - opening, main and auxiliary.
  */
 private function extractWikitextParts()
 {
     if (!is_null($this->allText)) {
         return;
     }
     $this->parserOutput->setEditSectionTokens(false);
     $this->parserOutput->setTOCEnabled(false);
     $text = $this->parserOutput->getText();
     if (strlen($text) == 0) {
         $this->allText = "";
         // empty text - nothing to seek here
         return;
     }
     $opening = null;
     $this->openingText = $this->extractHeadingBeforeFirstHeading($text);
     // Add extra spacing around break tags so text crammed together like<br>this
     // doesn't make one word.
     $text = str_replace('<br', "\n<br", $text);
     $formatter = new HtmlFormatter($text);
     // Strip elements from the page that we never want in the search text.
     $formatter->remove($this->excludedElementSelectors);
     $formatter->filterContent();
     // Strip elements from the page that are auxiliary text.  These will still be
     // searched but matches will be ranked lower and non-auxiliary matches will be
     // preferred in highlighting.
     $formatter->remove($this->auxiliaryElementSelectors);
     $auxiliaryElements = $formatter->filterContent();
     $this->allText = trim(Sanitizer::stripAllTags($formatter->getText()));
     foreach ($auxiliaryElements as $auxiliaryElement) {
         $this->auxText[] = trim(Sanitizer::stripAllTags($formatter->getText($auxiliaryElement)));
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:35,代码来源:WikiTextStructure.php


注:本文中的ParserOutput::setTOCEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。