Skip to content

Commit fceef59

Browse files
author
Tieg Zaharia
committed
consider non-breaking spaces as whitespace
1 parent cb1b84b commit fceef59

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/rails_autolink/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def auto_link(text, *args, &block) #link = :all, html = {}, &block)
7272

7373
AUTO_LINK_RE = %r{
7474
(?: ((?:ed2k|ftp|http|https|irc|mailto|news|gopher|nntp|telnet|webcal|xmpp|callto|feed|svn|urn|aim|rsync|tag|ssh|sftp|rtsp|afs|file):)// | www\. )
75-
[^\s<]+
75+
[^\s<\u00A0]+
7676
}x
7777

7878
# regexps for determining context, used high-volume

test/test_rails_autolink.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ def test_auto_link
266266
with_kcode 'u' do
267267
assert_equal %(浅草.rbの公式サイトはこちら#{link11_result}), auto_link("浅草.rbの公式サイトはこちら#{link11_raw}")
268268
end
269+
270+
link12_raw = 'http://tools.ietf.org/html/rfc3986'
271+
link12_result = generate_result(link12_raw)
272+
assert_equal %(<p>#{link12_result} text-after-nonbreaking-space</p>), auto_link("<p>#{link12_raw} text-after-nonbreaking-space</p>")
269273
end
270274

271275
def test_auto_link_parsing

0 commit comments

Comments
 (0)