3 use HtmlFormatter\HtmlFormatter;
37 'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
42 '.navigation-not-searchable'
84 foreach ( $this->parserOutput->getSections()
as $heading ) {
85 $heading = $heading[
'line' ];
89 $heading = preg_replace(
'/<\/?span>/',
'', $heading );
91 $heading = preg_replace( [
'/[/',
'/]/' ], [
'[',
']' ], $heading );
92 $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/is',
'', $heading );
95 $heading = trim( Sanitizer::stripAllTags( $heading ) );
99 if ( !in_array( $heading, $ignoredHeadings ) ) {
100 $headings[] = $heading;
114 $lines = explode(
"\n", $message );
126 static $ignoredHeadings =
null;
127 if ( $ignoredHeadings ===
null ) {
128 $ignoredHeadings = [];
132 $source =
wfMessage(
'cirrussearch-ignored-headings' )->inContentLanguage();
134 if ( !
$source->isDisabled() ) {
136 $ignoredHeadings =
$lines;
139 return $ignoredHeadings;
146 if ( !is_null( $this->allText ) ) {
149 $this->parserOutput->setEditSectionTokens(
false );
150 $this->parserOutput->setTOCEnabled(
false );
151 $text = $this->parserOutput->getText();
152 if ( strlen( $text ) == 0 ) {
163 $text = str_replace(
'<br',
"\n<br", $text );
165 $formatter =
new HtmlFormatter( $text );
168 $formatter->remove( $this->excludedElementSelectors );
169 $formatter->filterContent();
174 $formatter->remove( $this->auxiliaryElementSelectors );
175 $auxiliaryElements = $formatter->filterContent();
176 $this->allText = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
177 foreach ( $auxiliaryElements
as $auxiliaryElement ) {
179 trim( Sanitizer::stripAllTags( $formatter->getText( $auxiliaryElement ) ) );
190 if ( !preg_match(
'/<h[123456]>/', $text,
$matches, PREG_OFFSET_CAPTURE ) ) {
195 $text = substr( $text, 0,
$matches[ 0 ][ 1 ] );
202 $formatter =
new HtmlFormatter( $text );
203 $formatter->remove( $this->excludedElementSelectors );
204 $formatter->remove( $this->auxiliaryElementSelectors );
205 $formatter->filterContent();
206 $text = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
249 return $this->parserOutput->getProperty(
'defaultsort' );