jenkins-bot has submitted this change and it was merged.
Change subject: Fix reference handling
......................................................................
Fix reference handling
Bug: T132710
Change-Id: Ife2a9a2bfc7e4811e54baeda19e4de13eee1d1ca
---
M includes/BuildDocument/PageDataBuilder.php
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/BuildDocument/PageDataBuilder.php
b/includes/BuildDocument/PageDataBuilder.php
index c8de1d1..1574450 100644
--- a/includes/BuildDocument/PageDataBuilder.php
+++ b/includes/BuildDocument/PageDataBuilder.php
@@ -103,12 +103,16 @@
// we don't remove the whole <sup> tag. We also don't
want to strip the <sup> tag and remove
// everything that looks like [2] because, I dunno,
maybe there is a band named Word [2] Foo
// or something. Whatever. So we only strip things
that look like <sup> tags wrapping a
- // refence. And we do it with regexes because
HtmlFormatter doesn't support css selectors.
+ // reference. And since the data looks like:
+ // Reference in heading
<sup>[1]</sup><sup>[2]</sup>
+ // we can not really use HtmlFormatter as we have no
suitable selector.
// Some wikis wrap the brackets in a span:
//
http://en.wikipedia.org/wiki/MediaWiki:Cite_reference_link
$heading = preg_replace( '/<\/?span>/', '', $heading );
- $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/', '', $heading );
+ // Normalize [] so the following regexp would work.
+ $heading = preg_replace( [ '/[/', '/]/' ], [
'[', ']' ], $heading );
+ $heading = preg_replace(
'/<sup>\s*\[\s*\d+\s*\]\s*<\/sup>/is', '', $heading );
// Strip tags from the heading or else we'll display
them (escaped) in search results
$heading = trim( Sanitizer::stripAllTags( $heading ) );
--
To view, visit https://gerrit.wikimedia.org/r/283495
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ife2a9a2bfc7e4811e54baeda19e4de13eee1d1ca
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits