Project

General

Profile

Patch #22898 » 0001-Fix-HTML-generated-for-floating-images-in-paragraphs.patch

Gregor Schmidt, 2016-05-25 13:14

View differences:

lib/redcloth3.rb
if stln == "<p>"
out = "<p style=\"float:#{ algn }\">#{ out }"
else
out = "#{ stln }<div style=\"float:#{ algn }\">#{ out }</div>"
out = "#{ stln }<span style=\"float:#{ algn }\">#{ out }</span>"
end
else
out = stln + out
test/unit/helpers/application_helper_test.rb
def test_inline_images
to_test = {
'!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
'floating !>http://foo.bar/image.jpg!' => 'floating <span style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></span>',
'with class !(some-class)http://foo.bar/image.jpg!' => 'with class <img src="http://foo.bar/image.jpg" class="some-class" alt="" />',
'with style !{width:100px;height:100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" style="width:100px;height:100px;" alt="" />',
'with title !http://foo.bar/image.jpg(This is a title)!' => 'with title <img src="http://foo.bar/image.jpg" title="This is a title" alt="This is a title" />',
(1-1/2)