Invalid html generated by wiki formatter
Links generated by the wiki are invalid when they contain something that could be an email. For example, this :
is transformed to
<a class=\"external\" href=\"http://<a href=\"mailto:email@example.com\" class=\"email\">firstname.lastname@example.org</a>\">http://<a href=\"mailto:email@example.com\" class=\"email\">firstname.lastname@example.org</a></a>
and rendered as this http://email@example.com in a web browser.
I observed this problem by using
hg fetch that generates commit messages like :
Automated merge with https://firstname.lastname@example.org/project.
Here is a patch that solves the problem and a unit test. The code come from http://dev.rubyonrails.org/changeset/7516. The only limitation of this solution is in that case :
where only the first link is detected. I did not found the magic regexp. Maybe this could be solved with some lookbehind but the syntax is not supported on ruby 1.8.