Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232540

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/40/232540/1

diff --git a/src/ui/actions/ve.ui.LinkAction.js 
b/src/ui/actions/ve.ui.LinkAction.js
index 137d42c..288ae43 100644
--- a/src/ui/actions/ve.ui.LinkAction.js
+++ b/src/ui/actions/ve.ui.LinkAction.js
@@ -147,7 +147,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: newchange
Gerrit-Change-Id: I58a9c7f97ef10d9f495e65da17f208b9fc431aa4
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to