jenkins-bot has submitted this change and it was merged.
Change subject: Use exchars instead of exsentences for the extract
..
Use exchars instead of exsentences for the extract
To avoid sentence parsing bugs in other languages.
We have to artificially remove the always-added ellipsis from textextracts to
mimic previous behavior, and we'll add ellipsis via CSS afterwards.
Bug: T135824
Change-Id: Idf27f2fd18f7197e588c609eeb62ac8fc80626d7
---
M resources/ext.popups.renderer.article.js
1 file changed, 16 insertions(+), 1 deletion(-)
Approvals:
Phuedx: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/ext.popups.renderer.article.js
b/resources/ext.popups.renderer.article.js
index 14ec6e9..ac8363a 100644
--- a/resources/ext.popups.renderer.article.js
+++ b/resources/ext.popups.renderer.article.js
@@ -9,6 +9,12 @@
$window = $( window );
/**
+* Number of chars to request for the article extract
+* @property CHARS
+*/
+ article.CHARS = 525;
+
+ /**
* Size constants for popup images
* @property SIZES
*/
@@ -55,7 +61,7 @@
formatversion: 2,
redirects: true,
exintro: true,
- exsentences: 5,
+ exchars: article.CHARS,
// there is an added geometric limit on
.mwe-popups-extract
// so that text does not overflow from the card
explaintext: true,
@@ -99,6 +105,8 @@
deferred.reject();
return;
}
+
+ re.query.pages[ 0 ].extract = removeEllipsis(
re.query.pages[ 0 ].extract );
mw.popups.render.cache[ href ] = {};
mw.popups.render.cache[ href ].popup =
article.createPopup( re.query.pages[ 0 ], href );
@@ -667,4 +675,11 @@
*/
mw.popups.render.getClosestYPosition = getClosestYPosition;
+ /**
+* Remove ellipsis if exists at the end
+*/
+ function removeEllipsis( text ) {
+ return text.replace( /\.\.\.$/, '' );
+ }
+
} )( jQuery, mediaWiki );
--
To view, visit https://gerrit.wikimedia.org/r/290913
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf27f2fd18f7197e588c609eeb62ac8fc80626d7
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Jhernandez
Gerrit-Reviewer: Jhernandez
Gerrit-Reviewer: Jhobs
Gerrit-Reviewer: Phuedx
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits