|
commit 341115750af4e93c91b29c23577c37fa173d68e9 |
|
|
|
Strip tags only in Special:Search |
|
|
|
The way T355481 was solved, implies removing any HTML tag from the link |
|
text, and then compare that text with the original title, rendering the |
|
DisplayTitle property instead of the provided text. |
|
|
|
Outside of the Special:Search results, it prevents *any form of styles* |
|
added to the link text when the stripped text matches the page title. |
|
For example, [[Foo|<i>Foo</i>]] will be rendered as [[Foo|Foo]]. This |
|
also prevents any form of cancellation of the displaytitle where the |
|
user wants to actually display the page title unchanged, for example, |
|
by writing [[Foo|<span>Foo</span>]]. |
|
|
|
To solve the original bug while letting users personalize the link text, |
|
the strip of HTML tags is performed only in Special:Search. |
|
|
|
Bug: T355481 |
|
Change-Id: Ia41a1d7e26723db85b94edba0dcee25f7398163d |
|
|
|
diff --git a/includes/DisplayTitleService.php b/includes/DisplayTitleService.php |
|
index cf0bf91..f493c61 100644 |
|
--- a/includes/DisplayTitleService.php |
|
+++ b/includes/DisplayTitleService.php |
|
@@ -92,8 +92,10 @@ class DisplayTitleService { |
|
$text = (string)$html; |
|
} elseif ( $html instanceof HtmlArmor ) { |
|
$text = HtmlArmor::getHtml( $html ); |
|
- // Remove html tags used for highlighting matched words in the title, see T355481 |
|
- $text = strip_tags( $text ); |
|
+ if ( $title->isSpecial( 'Search' ) ) { |
|
+ // Remove html tags used for highlighting matched words in the title, see T355481 |
|
+ $text = strip_tags( $text ); |
|
+ } |
|
$text = str_replace( '_', ' ', $text ); |
|
} |
|
|