Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232646
Change subject: [PULL THROUGH] Strip trailing quotes and non-URL characters
when autolinking
......................................................................
[PULL THROUGH] Strip trailing quotes and non-URL characters when autolinking
Update ve-mw to match I58a9c7f97ef10d9f495e65da17f208b9fc431aa4 in core,
since otherwise the ve.ui.LinkAction.test.js case with a quoted link
will begin to fail.
Make the set of stripped characters better match the combination of
EXT_LINK_URL_CLASS in the PHP parser and the explicitly-stripped
trailing punctuation in Parser.php::makeFreeExternalLink().
Add some international quotation marks while we're at it to make
everyone equally happy.
Change-Id: Iaffac4b073aeafa4f1137265c2d95e425c24d553
---
M modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
1 file changed, 9 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/46/232646/1
diff --git a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
index 62acfa8..a9f44de 100644
--- a/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
+++ b/modules/ve-mw/ui/actions/ve.ui.MWLinkAction.js
@@ -45,7 +45,15 @@
* @inheritdoc
*/
ve.ui.MWLinkAction.prototype.getTrailingPunctuation = function ( candidate ) {
- return /\(/.test( candidate ) ? /[,;.:!?]+$/ : /[,;.:!?)]+$/;
+ // This is:
+ // * the "trailing punctuation" character set from
+ // Parse.php::makeFreeExternalLink(): [,;.:!?] and sometimes [)]
+ // * extended with characters banned by EXT_LINK_URL_CLASS: []<>"
+ // * further extended with international close quotes: "'”’›»“‘‹«」』
+ // https://en.wikipedia.org/wiki/Quotation_mark
+ return /\(/.test( candidate ) ?
+ /[,;.:!?\[\]<>\"\'”’›»“‘‹«」』]+$/ :
+ /[,;.:!?\[\]<>\"\'”’›»“‘‹«」』)]+$/;
};
/**
--
To view, visit https://gerrit.wikimedia.org/r/232646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaffac4b073aeafa4f1137265c2d95e425c24d553
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits