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 );
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 ) {
166 $text = str_replace(
'<br',
"\n<br", $text );
168 $formatter =
new HtmlFormatter( $text );
171 $formatter->remove( $this->excludedElementSelectors );
172 $formatter->filterContent();
177 $formatter->remove( $this->auxiliaryElementSelectors );
178 $auxiliaryElements = $formatter->filterContent();
180 foreach ( $auxiliaryElements
as $auxiliaryElement ) {
193 if ( !preg_match(
'/<h[123456]>/', $text,
$matches, PREG_OFFSET_CAPTURE ) ) {
198 $text = substr( $text, 0,
$matches[ 0 ][ 1 ] );
205 $formatter =
new HtmlFormatter( $text );
206 $formatter->remove( $this->excludedElementSelectors );
207 $formatter->remove( $this->auxiliaryElementSelectors );
208 $formatter->filterContent();
252 return $this->parserOutput->getProperty(
'defaultsort' );