Skip to content

Commit

Permalink
Make auto_link match urls with a port number specified.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3351 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
Marcel Molina committed Dec 26, 2005
1 parent eb53467 commit 839f03b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/text_helper.rb
Expand Up @@ -324,7 +324,7 @@ def set_cycle(name, cycle_object)
(?:www\.) # www.*
)
(
([\w]+[=?&\/.-]?)* # url segment
([\w]+:?[=?&\/.-]?)* # url segment
\w+[\/]? # url tail
(?:\#\w*)? # trailing anchor
)
Expand Down
3 changes: 3 additions & 0 deletions actionpack/test/template/text_helper_test.rb
Expand Up @@ -128,6 +128,8 @@ def test_auto_linking
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>}
link5_raw = 'http://foo.example.com:3000/controller/action'
link5_result = %{<a href="#{link5_raw}">#{link5_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)
Expand All @@ -152,6 +154,7 @@ def test_auto_linking
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>")
assert_equal %(<p>#{link5_result} Link</p>), auto_link("<p>#{link5_raw} Link</p>")
end

def test_auto_link_at_eol
Expand Down

0 comments on commit 839f03b

Please sign in to comment.