From 480150e5fb73f1a6a23bb08fdf9a537ccbd6f60d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 6 Apr 2005 15:22:32 +0000 Subject: Fixed autolinking to work better in more cases #1013 [Jamis Buck] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1099 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/text_helper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 043e1dc305..5fcb8a250f 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -157,7 +157,14 @@ module ActionView # Turns all urls into clickable links. def auto_link_urls(text) - text.gsub(/([^=>\3\4\5\6\7') + text.gsub(/(<\w+.*?>|[^=!:'"\/]|^)((?:http[s]?:\/\/)|(?:www\.))([^\s<]+\/?)([[:punct:]]|\s|<|$)/) do + all, a, b, c, d = $&, $1, $2, $3, $4 + if a =~ /#{b}#{c}#{d}) + end + end end # Turns all email addresses into clickable links. -- cgit v1.2.3