Patch #22898

!>image.png! generates invalid HTML

Added by Gregor Schmidt over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

90%

Category:Text formatting
Target version:3.2.3

Description

Redmine's RedCloth (current trunk r15425) generates the following HTML:

Input: !>test.png! Paragraph with floating image

Output: <p><div style="float:right"><img src="test.png" alt="" /></div> Paragraph with floating image</p>

The div within the p is not allowed, therefore HTML parsers will autoclose the p, the div becomes a sibling to it, the text content will become another sibling and the closing p will trigger another empty p element.

This is what's generated in Firefox's DOM: <p></p><div style="float:right"><img src="test.png" alt=""/> Paragraph with floating image<p></p>.

The attached patch simply adds a span instead of a div and therefore generates the expected DOM structure.

0001-Fix-HTML-generated-for-floating-images-in-paragraphs.patch Magnifier (2.08 KB) Gregor Schmidt, 2016-05-25 13:14

firebug-output.png (17.4 KB) Go MAEDA, 2016-06-03 02:19


Related issues

Blocks Redmine - Feature #22923: Export Wiki to ODT New

Associated revisions

Revision 15442
Added by Jean-Philippe Lang over 1 year ago

Fix HTML generated for floating images in paragraphs (#22898).

Patch by Gregor Schmidt.

History

#2 Updated by Anonymous over 1 year ago

  • File t_icon_fighter_skill5.png added

#3 Updated by Go MAEDA over 1 year ago

  • File deleted (t_icon_fighter_skill5.png)

#4 Updated by Jan from Planio www.plan.io over 1 year ago

#5 Updated by Jan from Planio www.plan.io over 1 year ago

  • Target version set to Candidate for next minor release
  • % Done changed from 0 to 90

#6 Updated by Go MAEDA over 1 year ago

  • File firebug-output.png added
  • Target version changed from Candidate for next minor release to 3.3.0

Confirmed the problem. Firebug reports the DOM like the following. We can see "<p> </p>".

Setting target version to 3.3.0.

#7 Updated by Jean-Philippe Lang over 1 year ago

  • Target version changed from 3.3.0 to 3.2.3

#8 Updated by Jean-Philippe Lang over 1 year ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

Also available in: Atom PDF