aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-09-14 12:07:05 +0000
committerJamis Buck <jamis@37signals.com>2005-09-14 12:07:05 +0000
commit5e3364ef452d8b3d6e1b4eacfd9c8939be392c29 (patch)
treebff35c02ab0750362d14c3ecfb1ccb33dbf19cbf /actionpack
parenta20ad655b5e09d104acd3c1be79c2b49cfd26e6d (diff)
downloadrails-5e3364ef452d8b3d6e1b4eacfd9c8939be392c29.tar.gz
rails-5e3364ef452d8b3d6e1b4eacfd9c8939be392c29.tar.bz2
rails-5e3364ef452d8b3d6e1b4eacfd9c8939be392c29.zip
More auto-link fixes (to include query strings in autolinked text)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2241 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb2
-rw-r--r--actionpack/test/template/text_helper_test.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 7b883a8b27..bc753262f2 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -290,7 +290,7 @@ module ActionView
(?:www\.) # www.*
)
(
- ([\w]+[\/.-]?)* # url segment
+ ([\w]+[=?&\/.-]?)* # url segment
\w+[\/]? # url tail
(?:\#\w*)? # trailing anchor
)
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index f56207f1f1..383e9f64f8 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -95,6 +95,8 @@ class TextHelperTest < Test::Unit::TestCase
link2_result = %{<a href="http://#{link2_raw}">#{link2_raw}</a>}
link3_raw = 'http://manuals.ruby-on-rails.com/read/chapter.need_a-period/103#page281'
link3_result = %{<a href="#{link3_raw}">#{link3_raw}</a>}
+ link4_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor123'
+ link4_result = %{<a href="#{link4_raw}">#{link4_raw}</a>}
assert_equal %(hello #{email_result}), auto_link("hello #{email_raw}", :email_addresses)
assert_equal %(Go to #{link_result}), auto_link("Go to #{link_raw}", :urls)
@@ -117,6 +119,8 @@ class TextHelperTest < Test::Unit::TestCase
assert_equal %(<p>#{link3_result} Link</p>), auto_link("<p>#{link3_raw} Link</p>")
assert_equal %(Go to #{link3_result}.), auto_link(%(Go to #{link3_raw}.))
assert_equal %(<p>Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.</p>))
+ assert_equal %(<p>Link #{link4_result}</p>), auto_link("<p>Link #{link4_raw}</p>")
+ assert_equal %(<p>#{link4_result} Link</p>), auto_link("<p>#{link4_raw} Link</p>")
end
def test_auto_link_at_eol