This project is archived and is in readonly mode.
Running autolink on text containing a mailto: link breaks
-
Amos King
- Tag changed from ruby 1.8.7, actionview, auto_link, bug, edge, text_helper to ruby 1.8.7, actionview, auto_link, bug, edge, patch, text_helper
+1
-
Michael Koziarski
That patch isn't a patch ;)
But more fundamentally, does the other auto_link functionality support already linked text? I didn't see it looking at the tests but perhaps I'm missing it.
If it does, then let's pull that kind of test into a new test case for both emails and urls.
-
marek
Oops,
Please excuse me for screwing up. I added a proper diff file this time.
I guess this feature is not often used.
But yes, there is such a test in text_helper_test.rb. It's called test_auto_link_already_linked. I've expanded that test so it covers this issue too, please see patch.
-
marek
Very much related to this issue:
If the html contains an img tag it gets screwed up too. I fixed that as well. See second patch file.
-
Mislav
The second issue (IMG tag) was resolved in #1523 auto_link should not linkify URLs in the middle of a tag.
I'm attaching a patch that takes the same approach as that ticket for the first issue you reported. It's very similar to your patch, only it handles all cases of email strings found inside HTML attributes.
-
marek
Thanks for taking the time to look at my patch. I was not aware of #1523 auto_link should not linkify URLs in the middle of a tag. Using the same approach makes sense.
-
Mislav
- Tag changed from ruby 1.8.7, actionview, auto_link, bug, edge, patch, text_helper to actionview, auto_link, patch
I've pushes two patches which resolve all auto_link issues in this tracker. Changes are in the "auto_link" branch of my fork
-
Mislav
I've just pushed 2-3-stable compatible version. The branch name is "auto_link_2-3-stable"
-
Repository
- State changed from new to resolved
(from [17b4fd25e4de8f05d40ccaa776e51636745aa8e8]) avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523 auto_link should not linkify URLs in the middle of a tag [#1862 Running autolink on text containing a mailto: link breaks state:resolved] [#3591 auto_link should not create a link inside a link which has the rel attribute state:resolved]
Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination withraw.
Let link text be automatically HTML-escaped[#2017 Should not html_escape auto_link block form state:resolved] http://github.com/rails/rails/commit/17b4fd25e4de8f05d40ccaa776e516...
-
Repository
(from [8f0b2138ee979799092e0489f7298289c90901b9]) avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523 auto_link should not linkify URLs in the middle of a tag [#1862 Running autolink on text containing a mailto: link breaks state:resolved] [#3591 auto_link should not create a link inside a link which has the rel attribute state:resolved]
Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination withraw.
Let link text be automatically HTML-escaped[#2017 Should not html_escape auto_link block form state:resolved] http://github.com/rails/rails/commit/8f0b2138ee979799092e0489f72982...
