Use ParserOutput stateless transforms
[lhc/web/wiklou.git] / includes / content / WikiTextStructure.php
index 9f79aa8..0eadc3c 100644 (file)
@@ -37,6 +37,9 @@ class WikiTextStructure {
                'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
                // Collapsed fields are hidden by default so we don't want them showing up.
                '.autocollapse',
+               // Content explicitly decided to be not searchable by editors such
+               // as custom navigation templates.
+               '.navigation-not-searchable'
        ];
 
        /**
@@ -56,7 +59,6 @@ class WikiTextStructure {
        ];
 
        /**
-        * WikiTextStructure constructor.
         * @param ParserOutput $parserOutput
         */
        public function __construct( ParserOutput $parserOutput ) {
@@ -144,9 +146,10 @@ class WikiTextStructure {
                if ( !is_null( $this->allText ) ) {
                        return;
                }
-               $this->parserOutput->setEditSectionTokens( false );
-               $this->parserOutput->setTOCEnabled( false );
-               $text = $this->parserOutput->getText();
+               $text = $this->parserOutput->getText( [
+                       'enableSectionEditTokens' => false,
+                       'allowTOC' => false,
+               ] );
                if ( strlen( $text ) == 0 ) {
                        $this->allText = "";
                        // empty text - nothing to seek here