Image link not recognized with alt text
RedCloth.new("!/image_r.jpg(description)!:image.jpg").to_html <p><a href="image.jpg"><img src="/image_r.jpg" title="description" alt="description" /></a></p>
That is correct.
Then we just add an "a" (or anything else) to the end of the string:
RedCloth.new("!/image_r.jpg(description)!:image.jpg a").to_html Incorrect result (link is missed): <p><img src="/image_r.jpg" title="description" alt="description" /> a</p>
It only happens when "(description)" is present.
Comments and changes to this ticket
Just some more information stripped from the original e-mail:
The bug is present in 4.1.9, but not in any previous version, including 4.1.1.
The test cases don't contain the presented use case. Maybe it should be necessary to work in all test suite to work in a different approach. I found this bug because of a test case from my own in a Rails application I maintain. This happened when I upgraded RedCloth and some of my test cases didn't pass. Instead of just writing small pieces of text, it would be very interesting to have a whole text exploring all those minor tests and using assert_match to catch all snippets that the textilized text should contain.