3 use HtmlFormatter\HtmlFormatter;
39 'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
44 '.navigation-not-searchable',
46 '.wbmi-entityview-emptyCaption',
88 foreach ( $this->parserOutput->getSections() as $heading ) {
89 $heading = $heading[
'line' ];
93 $heading = preg_replace(
'/<\/?span>/',
'', $heading );
95 $heading = preg_replace( [
'/[/',
'/]/' ], [
'[',
']' ], $heading );
96 $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/is',
'', $heading );
99 $heading = trim( Sanitizer::stripAllTags( $heading ) );
103 if ( !in_array( $heading, $ignoredHeadings ) ) {
104 $headings[] = $heading;
118 $lines = explode(
"\n", $message );
130 static $ignoredHeadings =
null;
131 if ( $ignoredHeadings ===
null ) {
132 $ignoredHeadings = [];
136 $source =
wfMessage(
'cirrussearch-ignored-headings' )->inContentLanguage();
138 if ( !
$source->isDisabled() ) {
140 $ignoredHeadings =
$lines;
143 return $ignoredHeadings;
150 if ( !is_null( $this->allText ) ) {
153 $text = $this->parserOutput->getText( [
154 'enableSectionEditTokens' =>
false,
157 if ( $text ===
'' ) {
166 $formatter =
new HtmlFormatter( $text );
169 $formatter->remove( $this->excludedElementSelectors );
170 $formatter->filterContent();
175 $formatter->remove( $this->auxiliaryElementSelectors );
176 $auxiliaryElements = $formatter->filterContent();
177 $this->allText = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
178 foreach ( $auxiliaryElements as $auxiliaryElement ) {
180 trim( Sanitizer::stripAllTags( $formatter->getText( $auxiliaryElement ) ) );
191 if ( !preg_match(
'/<h[123456]>/', $text,
$matches, PREG_OFFSET_CAPTURE ) ) {
196 $text = substr( $text, 0,
$matches[ 0 ][ 1 ] );
203 $formatter =
new HtmlFormatter( $text );
204 $formatter->remove( $this->excludedElementSelectors );
205 $formatter->remove( $this->auxiliaryElementSelectors );
206 $formatter->filterContent();
207 $text = trim( Sanitizer::stripAllTags( $formatter->getText() ) );
250 return $this->parserOutput->getProperty(
'defaultsort' );