aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-09-11 05:53:52 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-09-11 05:53:52 +0000
commitda7ba91d8666770c6288f8d25cd501fd227b0413 (patch)
treee869b873b679a6d05390181c19d685847468a83b /actionpack/lib/action_view
parent04594cfadbfffceb087e1151f8b81255108d5211 (diff)
downloadrails-da7ba91d8666770c6288f8d25cd501fd227b0413.tar.gz
rails-da7ba91d8666770c6288f8d25cd501fd227b0413.tar.bz2
rails-da7ba91d8666770c6288f8d25cd501fd227b0413.zip
Fixed that TextHelper#auto_link_urls would include punctuation in the links #2166, #1671 [eigentone]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2183 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index e8b7d7810a..217cf6c9f8 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -199,8 +199,8 @@ module ActionView
# Turns all urls into clickable links.
def auto_link_urls(text, href_options = {})
- text.gsub(/(<\w+.*?>|[^=!:'"\/]|^)((?:http[s]?:\/\/)|(?:www\.))([^\s<]+\/?)([[:punct:]]|\s|<|$)/) do
- all, a, b, c, d = $&, $1, $2, $3, $4
+ text.gsub(/(<\w+.*?>|[^=!:'"\/]|^)((?:http[s]?:\/\/)|(?:www\.))(([\w]+[[:punct:]]?)*\w+[\/]?)([[:punct:]]|\s|<|$)/) do
+ all, a, b, c, d = $&, $1, $2, $3, $5
if a =~ /<a\s/i # don't replace URL's that are already linked
all
else