3 use HtmlFormatter\HtmlFormatter;
37 'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
42 '.navigation-not-searchable'
85 foreach ( $this->parserOutput->getSections()
as $heading ) {
86 $heading = $heading[
'line' ];
90 $heading = preg_replace(
'/<\/?span>/',
'', $heading );
92 $heading = preg_replace( [
'/[/',
'/]/' ], [
'[',
']' ], $heading );
93 $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/is',
'', $heading );
96 $heading = trim( Sanitizer::stripAllTags( $heading ) );
100 if ( !in_array( $heading, $ignoredHeadings ) ) {
101 $headings[] = $heading;
115 $lines = explode(
"\n", $message );
127 static $ignoredHeadings =
null;
128 if ( $ignoredHeadings ===
null ) {
129 $ignoredHeadings = [];
133 $source =
wfMessage(
'cirrussearch-ignored-headings' )->inContentLanguage();
135 if ( !
$source->isDisabled() ) {
137 $ignoredHeadings =
$lines;
140 return $ignoredHeadings;
147 if ( !is_null( $this->allText ) ) {
150 $this->parserOutput->setEditSectionTokens(
false );
151 $this->parserOutput->setTOCEnabled(
false );
152 $text = $this->parserOutput->getText();
153 if ( strlen( $text ) == 0 ) {
164 $text = str_replace(
'<br',
"\n<br", $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' );