3 use HtmlFormatter\HtmlFormatter;
39 'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
44 '.navigation-not-searchable'
86 foreach ( $this->parserOutput->getSections()
as $heading ) {
87 $heading = $heading[
'line' ];
91 $heading = preg_replace(
'/<\/?span>/',
'', $heading );
93 $heading = preg_replace( [
'/[/',
'/]/' ], [
'[',
']' ], $heading );
94 $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/is',
'', $heading );
97 $heading = trim( Sanitizer::stripAllTags( $heading ) );
101 if ( !in_array( $heading, $ignoredHeadings ) ) {
102 $headings[] = $heading;
116 $lines = explode(
"\n", $message );
128 static $ignoredHeadings =
null;
129 if ( $ignoredHeadings ===
null ) {
130 $ignoredHeadings = [];
134 $source =
wfMessage(
'cirrussearch-ignored-headings' )->inContentLanguage();
136 if ( !
$source->isDisabled() ) {
138 $ignoredHeadings =
$lines;
141 return $ignoredHeadings;
148 if ( !is_null( $this->allText ) ) {
151 $text = $this->parserOutput->getText( [
152 'enableSectionEditTokens' =>
false,
155 if ( strlen( $text ) == 0 ) {
164 $formatter =
new HtmlFormatter( $text );
167 $formatter->remove( $this->excludedElementSelectors );
168 $formatter->filterContent();
173 $formatter->remove( $this->auxiliaryElementSelectors );
174 $auxiliaryElements = $formatter->filterContent();
175 $this->allText = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
176 foreach ( $auxiliaryElements
as $auxiliaryElement ) {
178 trim( Sanitizer::stripAllTags( $formatter->getText( $auxiliaryElement ) ) );
189 if ( !preg_match(
'/<h[123456]>/', $text,
$matches, PREG_OFFSET_CAPTURE ) ) {
194 $text = substr( $text, 0,
$matches[ 0 ][ 1 ] );
201 $formatter =
new HtmlFormatter( $text );
202 $formatter->remove( $this->excludedElementSelectors );
203 $formatter->remove( $this->auxiliaryElementSelectors );
204 $formatter->filterContent();
205 $text = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
248 return $this->parserOutput->getProperty(
'defaultsort' );