aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/text_helper.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-20 08:27:45 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-20 08:27:45 +0000
commit835cb43745e79521514738044b3cf0232957de0b (patch)
tree9a4e14f0c6bffe2f074c786762a7e3b6181f1d6a /actionpack/lib/action_view/helpers/text_helper.rb
parent0d99423727ce309ce4b2c5439575eab75dcf49eb (diff)
downloadrails-835cb43745e79521514738044b3cf0232957de0b.tar.gz
rails-835cb43745e79521514738044b3cf0232957de0b.tar.bz2
rails-835cb43745e79521514738044b3cf0232957de0b.zip
Revert [7397]. Reopens #7313.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7515 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/text_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 36795bf498..0c1d92cdc6 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -305,7 +305,7 @@ module ActionView
def auto_link(text, link = :all, href_options = {}, &block)
return '' if text.blank?
case link
- when :all then auto_link_email_addresses(auto_link_urls(text, href_options, &block), &block)
+ when :all then auto_link_urls(auto_link_email_addresses(text, &block), href_options, &block)
when :email_addresses then auto_link_email_addresses(text, &block)
when :urls then auto_link_urls(text, href_options, &block)
end
@@ -534,8 +534,8 @@ module ActionView
[-\w]+ # subdomain or domain
(?:\.[-\w]+)* # remaining subdomains or domain
(?::\d+)? # port
- (?:/(?:(?:[~\w\+@%-]|(?:[,.;:][^\s$]))+)?)* # path
- (?:\?[\w\+@%&=.;-]+)? # query string
+ (?:/(?:(?:[~\w\+%-]|(?:[,.;:][^\s$]))+)?)* # path
+ (?:\?[\w\+%&=.;-]+)? # query string
(?:\#[\w\-]*)? # trailing anchor
)
([[:punct:]]|\s|<|$) # trailing text
@@ -560,16 +560,10 @@ module ActionView
# Turns all email addresses into clickable links. If a block is given,
# each email is yielded and the result is used as the link text.
def auto_link_email_addresses(text)
- body = text.dup
text.gsub(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
text = $1
-
- if body.match(/<a\b[^>]*>(.*)(#{text})(.*)<\/a>/)
- text
- else
- display_text = (block_given?) ? yield(text) : text
- %{<a href="mailto:#{text}">#{display_text}</a>}
- end
+ text = yield(text) if block_given?
+ %{<a href="mailto:#{$1}">#{text}</a>}
end
end
end