mirror of
https://github.com/github/rails.git
synced 2026-01-29 00:08:15 -05:00
Fix auto_link helper for already linked urls. [#72 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
committed by
Pratik Naik
parent
cff2291df5
commit
1a73e98660
@@ -454,7 +454,7 @@ module ActionView
|
||||
( # leading text
|
||||
<\w+.*?>| # leading HTML tag, or
|
||||
[^=!:'"/]| # leading punctuation, or
|
||||
| # nothing
|
||||
^ # beginning of line
|
||||
)
|
||||
(
|
||||
(?:https?://)| # protocol spec, or
|
||||
@@ -468,7 +468,7 @@ module ActionView
|
||||
(?:\?[\w\+@%&=.;-]+)? # query string
|
||||
(?:\#[\w\-]*)? # trailing anchor
|
||||
)
|
||||
([[:punct:]]|\s|<|$) # trailing text
|
||||
([[:punct:]]|<|$|) # trailing text
|
||||
}x unless const_defined?(:AUTO_LINK_RE)
|
||||
|
||||
# Turns all urls into clickable links. If a block is given, each url
|
||||
|
||||
@@ -264,6 +264,7 @@ class TextHelperTest < ActionView::TestCase
|
||||
assert_equal '', auto_link(nil)
|
||||
assert_equal '', auto_link('')
|
||||
assert_equal "#{link_result} #{link_result} #{link_result}", auto_link("#{link_raw} #{link_raw} #{link_raw}")
|
||||
assert_equal '<a href="http://www.rubyonrails.com">Ruby On Rails</a>', auto_link('<a href="http://www.rubyonrails.com">Ruby On Rails</a>')
|
||||
end
|
||||
|
||||
def test_auto_link_at_eol
|
||||
|
||||
Reference in New Issue
Block a user