redcloth
redcloth copied to clipboard
Issues with image alignment formatters
According to the Textile images spec, images can be right or left aligned, or centred:
!>/carver.png!
!</carver.png!
!=/carver.png!
Trying this, using RedCloth 4.3.2:
irb(main):066:0> RedCloth.new( '!>/carver.png!' ).to_html
=> "<p style=\"float:right;\"><img src=\"/carver.png\" alt=\"\" /></p>"
irb(main):067:0> RedCloth.new( '!</carver.png!' ).to_html
=> "<p style=\"float:left;\"><img src=\"/carver.png\" alt=\"\" /></p>"
irb(main):068:0> RedCloth.new( '!=/carver.png!' ).to_html
=> "<p><img src=\"/carver.png\" alt=\"\" /></p>"
- RedCloth attempts the right & left alignment, but seems to ignore the centring alignment.
- If the input text is preceded by anything, the right & left alignments are ignored:
irb(main):069:0> RedCloth.new( 'Hello!>/carver.png!' ).to_html
=> "<p>Hello<img src=\"/carver.png\" alt=\"\" /></p>"
irb(main):070:0> RedCloth.new( 'Hello\n\n!>/carver.png!' ).to_html
=> "<p>Hello\\n\\n<img src=\"/carver.png\" alt=\"\" /></p>"