From 839f03b7d0ae9d9ff49cc777488630253186b184 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Mon, 26 Dec 2005 19:31:40 +0000 Subject: [PATCH] Make auto_link match urls with a port number specified. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3351 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_view/helpers/text_helper.rb | 2 +- actionpack/test/template/text_helper_test.rb | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 2d772dc1199f3..1dad31d9e6905 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Make auto_link match urls with a port number specified. [Marcel Molina Jr.] + * Added support for toggling visual effects to ScriptaculousHelper::visual_effect, #3323. [Thomas Fuchs] * Update to script.aculo.us to 1.5.0 rev. 3343 [Thomas Fuchs] diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 2c38ffb3454d6..1b1ca386c26e4 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -324,7 +324,7 @@ def set_cycle(name, cycle_object) (?: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 5bfe0709d9315..37c81e12a682d 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -128,6 +128,8 @@ def test_auto_linking link3_result = %{#{link3_raw}} link4_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor123' link4_result = %{#{link4_raw}} + link5_raw = 'http://foo.example.com:3000/controller/action' + link5_result = %{#{link5_raw}} 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) @@ -152,6 +154,7 @@ def test_auto_linking assert_equal %(

Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.

), auto_link(%(

Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.

)) assert_equal %(

Link #{link4_result}

), auto_link("

Link #{link4_raw}

") assert_equal %(

#{link4_result} Link

), auto_link("

#{link4_raw} Link

") + assert_equal %(

#{link5_result} Link

), auto_link("

#{link5_raw} Link

") end def test_auto_link_at_eol