jenkins-bot has submitted this change and it was merged.
Change subject: Strip trailing quotes when autolinking URLs
......................................................................
Strip trailing quotes when autolinking URLs
Add a few more characters to the trailing punctuation class used when
autolinking.
Change-Id: I58a9c7f97ef10d9f495e65da17f208b9fc431aa4
---
M src/ui/actions/ve.ui.LinkAction.js
M tests/ui/actions/ve.ui.LinkAction.test.js
2 files changed, 15 insertions(+), 1 deletion(-)
Approvals:
Jforrester: Looks good to me, but someone else must approve
Esanders: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ui/actions/ve.ui.LinkAction.js
b/src/ui/actions/ve.ui.LinkAction.js
index 9ef993c..660ff6e 100644
--- a/src/ui/actions/ve.ui.LinkAction.js
+++ b/src/ui/actions/ve.ui.LinkAction.js
@@ -148,7 +148,7 @@
*/
ve.ui.LinkAction.prototype.getTrailingPunctuation = function ( candidate ) {
/* jshint unused: false */
- return /[,;.:!?)\]\}]+$/;
+ return /[,;.:!?)\]\}"'”’»]+$/;
};
/**
diff --git a/tests/ui/actions/ve.ui.LinkAction.test.js
b/tests/ui/actions/ve.ui.LinkAction.test.js
index baa10d1..83e3bd2 100644
--- a/tests/ui/actions/ve.ui.LinkAction.test.js
+++ b/tests/ui/actions/ve.ui.LinkAction.test.js
@@ -100,6 +100,20 @@
msg: 'Strip trailing punctuation'
},
{
+ html: '<p>"http://example.com" xyz</p>',
+ range: new ve.Range( 2, 22 ),
+ method: 'autolinkUrl',
+ expectedRange: new ve.Range( 22, 22 ),
+ expectedData: function ( data, makeAnnotation )
{
+ var i,
+ a = makeAnnotation(
'http://example.com' );
+ for ( i = 2; i < 20; i++ ) {
+ data[ i ] = [ data[ i ], [ a ]
];
+ }
+ },
+ msg: 'Strip trailing quotes'
+ },
+ {
html: '<p>http://.) xyz</p>',
range: new ve.Range( 1, 11 ),
method: 'autolinkUrl',
--
To view, visit https://gerrit.wikimedia.org/r/232540
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I58a9c7f97ef10d9f495e65da17f208b9fc431aa4
Gerrit-PatchSet: 4
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits