From 4353717400d5a7a6dfec5f1dfbafd4c80e3415a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Sat, 13 Aug 2011 21:49:03 +0200 Subject: [PATCH] =?UTF-8?q?Handle=20double=20opening=20(=E2=80=9D)=20and?= =?UTF-8?q?=20closing=20(=E2=80=9D)=20quotation=20marks=20(U+201C=20&=20U+?= =?UTF-8?q?201D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.0/jquery.linkify-1.0-test.html | 1 + 1.0/jquery.linkify-1.0.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/1.0/jquery.linkify-1.0-test.html b/1.0/jquery.linkify-1.0-test.html index c30da83..ca10383 100644 --- a/1.0/jquery.linkify-1.0-test.html +++ b/1.0/jquery.linkify-1.0-test.html @@ -231,6 +231,7 @@

www.foo.is/

www.foo.is/path

Lorem ipsum, "http://www.foo.is" dolor sit amet,

+

Lorem ipsum, “http://www.foo.is” dolor sit amet,

<a href="https://www.foo.is">foo</a>

http://www.foo.is.

sed dowww.foo.is/b/sh?foo=1#w4f tempor

diff --git a/1.0/jquery.linkify-1.0.js b/1.0/jquery.linkify-1.0.js index 299ec6f..264bd18 100644 --- a/1.0/jquery.linkify-1.0.js +++ b/1.0/jquery.linkify-1.0.js @@ -69,8 +69,8 @@ (function($){ - var noProtocolUrl = /(^|["'(\s]|<)(www\..+?\..+?)((?:[:?]|\.+)?(?:\s|$)|>|[)"',])/g, - httpOrMailtoUrl = /(^|["'(\s]|<)((?:(?:https?|ftp):\/\/|mailto:).+?)((?:[:?]|\.+)?(?:\s|$)|>|[)"',])/g, + var noProtocolUrl = /(^|[“"'(\s]|<)(www\..+?\..+?)((?:[:?]|\.+)?(?:\s|$)|>|[)”"',])/g, + httpOrMailtoUrl = /(^|[“"'(\s]|<)((?:(?:https?|ftp):\/\/|mailto:).+?)((?:[:?]|\.+)?(?:\s|$)|>|[)”"',])/g, linkifier = function ( html ) { return html .replace( noProtocolUrl, '$1$2$3' ) // NOTE: we escape `"http` as `"<``>` to make sure `httpOrMailtoUrl` below doesn't find it as a false-positive