Permalink
Browse files

makes protocols regex case insensitive

  • Loading branch information...
xuanxu committed Oct 23, 2013
1 parent 33193b8 commit 5591c4a70460d0c36893300933c8bdf071442bd0
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/rails_autolink/helpers.rb
  2. +3 −1 test/test_rails_autolink.rb
@@ -73,7 +73,7 @@ def auto_link(text, *args, &block) #link = :all, html = {}, &block)
AUTO_LINK_RE = %r{
(?: ((?: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\. )
[^\s<\u00A0]+
- }x
+ }ix
# regexps for determining context, used high-volume
AUTO_LINK_CRE = [/<[^>]+$/, /^[^>]*>/, /<a\b.*?>/i, /<\/a>/i]
@@ -138,7 +138,6 @@ def test_auto_link_already_linked
assert_equal linked_email, auto_link(linked_email)
end
-
def test_auto_link_at_eol
url1 = "http://api.rubyonrails.com/Foo.html"
url2 = "http://www.ruby-doc.org/core/Bar.html"
@@ -278,6 +277,9 @@ def test_auto_link
link12_raw = 'http://tools.ietf.org/html/rfc3986'
link12_result = generate_result(link12_raw)
assert_equal %(<p>#{link12_result} text-after-nonbreaking-space</p>), auto_link("<p>#{link12_raw} text-after-nonbreaking-space</p>")
+
+ link13_raw = 'HTtP://www.rubyonrails.com'
+ assert_equal generate_result(link13_raw), auto_link(link13_raw)
end
def test_auto_link_parsing

0 comments on commit 5591c4a

Please sign in to comment.