diff options
author | Thomas Fuchs <thomas@fesch.at> | 2007-01-21 21:41:44 +0000 |
---|---|---|
committer | Thomas Fuchs <thomas@fesch.at> | 2007-01-21 21:41:44 +0000 |
commit | 8e82e2901004c3604da74d23220e7fc241aba739 (patch) | |
tree | ac4752bd3235e1ada2d215eb23a157d3d2dd4fe3 /actionpack/lib/action_view/helpers | |
parent | 0f8ed48bf5c8882f413e914fc64ce0d1c60cbbcb (diff) | |
download | rails-8e82e2901004c3604da74d23220e7fc241aba739.tar.gz rails-8e82e2901004c3604da74d23220e7fc241aba739.tar.bz2 rails-8e82e2901004c3604da74d23220e7fc241aba739.zip |
Make TextHelper::auto_link recognize URLs with colons in path correctly, fixes #7268
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index c921fcae4b..324ab54130 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -354,26 +354,26 @@ module ActionView @_cycles = Hash.new unless defined?(@_cycles) @_cycles[name] = cycle_object end - + AUTO_LINK_RE = %r{ - ( # leading text - <\w+.*?>| # leading HTML tag, or - [^=!:'"/]| # leading punctuation, or - ^ # beginning of line + ( # leading text + <\w+.*?>| # leading HTML tag, or + [^=!:'"/]| # leading punctuation, or + ^ # beginning of line ) ( - (?:https?://)| # protocol spec, or - (?:www\.) # www.* + (?:https?://)| # protocol spec, or + (?:www\.) # www.* ) ( - [-\w]+ # subdomain or domain - (?:\.[-\w]+)* # remaining subdomains or domain - (?::\d+)? # port - (?:/(?:[~\w\+%.;-]+)?)* # path - (?:\?[\w\+%&=.;-]+)? # query string - (?:\#[\w\-]*)? # trailing anchor + [-\w]+ # subdomain or domain + (?:\.[-\w]+)* # remaining subdomains or domain + (?::\d+)? # port + (?:/(?:[~\w\+%.;:-]+)?)* # path + (?:\?[\w\+%&=.;-]+)? # query string + (?:\#[\w\-]*)? # trailing anchor ) - ([[:punct:]]|\s|<|$) # trailing text + ([[:punct:]]|\s|<|$) # trailing text }x unless const_defined?(:AUTO_LINK_RE) # Turns all urls into clickable links. If a block is given, each url |