public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fix auto_link helper for already linked urls. [#72 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
kjg (author)
Thu May 22 12:21:33 -0700 2008
lifo (committer)
Thu May 22 13:10:40 -0700 2008
commit  1a73e98660b29a2ce9eccd5b0776367a4969a012
tree    11409f89e450878843adb4fcbe3c17f842f2c065
parent  cff2291df5d1df106ae8cf116655f0703f53f8c3
...
454
455
456
457
 
458
459
460
...
468
469
470
471
 
472
473
474
...
454
455
456
 
457
458
459
460
...
468
469
470
 
471
472
473
474
0
@@ -454,7 +454,7 @@ module ActionView
0
                         (                          # leading text
0
                           <\w+.*?>|                # leading HTML tag, or
0
                           [^=!:'"/]|               # leading punctuation, or
0
-                          |                        # nothing
0
+                          ^                        # beginning of line
0
                         )
0
                         (
0
                           (?:https?://)|           # protocol spec, or
0
@@ -468,7 +468,7 @@ module ActionView
0
                           (?:\?[\w\+@%&=.;-]+)?     # query string
0
                           (?:\#[\w\-]*)?           # trailing anchor
0
                         )
0
-                        ([[:punct:]]|\s|<|$)       # trailing text
0
+                        ([[:punct:]]|<|$|)       # trailing text
0
                        }x unless const_defined?(:AUTO_LINK_RE)
0
 
0
         # Turns all urls into clickable links.  If a block is given, each url
...
264
265
266
 
267
268
269
...
264
265
266
267
268
269
270
0
@@ -264,6 +264,7 @@ class TextHelperTest < ActionView::TestCase
0
     assert_equal '', auto_link(nil)
0
     assert_equal '', auto_link('')
0
     assert_equal "#{link_result} #{link_result} #{link_result}", auto_link("#{link_raw} #{link_raw} #{link_raw}")
0
+    assert_equal '<a href="http://www.rubyonrails.com">Ruby On Rails</a>', auto_link('<a href="http://www.rubyonrails.com">Ruby On Rails</a>')
0
   end
0
 
0
   def test_auto_link_at_eol

Comments