Ticket #2239 (closed defect (bug): fixed)

Opened 6 years ago

Last modified 4 years ago

Nested pre/blockquote in li produces invalid XHTML

Reported by: Juergen Owned by: pishmishy
Priority: normal Milestone: 2.6.1
Component: General Version: 2.0
Severity: normal Keywords: has-patch formatting wpautop xhtml
Cc:

Description

Entering the following code in the plain editor produces invalid XHTML in WP 2.0 (worked fine with 1.5):

<ul>
<li>before<pre>pre1
pre2</pre>
after</li>
</ul>

The result has an unclosed p:

<li>before
<pre>pre1
pre2</pre>
<p>after</li>
</ul>

If one inserts an empty line before the closing li after "after", the p gets closed.

Attachments

2239.patch Download (1.4 KB) - added by pishmishy 4 years ago.
freshened patch (woops)

Change History

  • Keywords needs-patch formatting added
  • Milestone set to 2.2

This is still happening in SVN version [4984], exactly as described. Seems like it should be fixed...

  • Milestone changed from 2.2 to 2.3

comment:3   ryan4 years ago

  • Milestone changed from 2.3 to 2.4

Still present in trunk. Bug is somewhere within wptexturize or wpautop.

  • Keywords has-patch wpautop added; needs-patch removed

This is caused by the ordering of replacements in wpautop(). "\n\n" is purposely inserted by one rule and later replaced with a <p> by another. The patch reorders the rules to avoid this.

  • Owner changed from anonymous to pishmishy
  • Status changed from new to assigned

Still present in trunk.

freshened patch (woops)

  • Keywords xhtml added

Attached a patch that cleanly applies to the current trunk code. Tested and appears to works fine.

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Milestone changed from 2.9 to 2.6.1

The current code in wpautop() seems to be exactly the same as the patch (apart from some insignificant white space). Closing as fixed, feel free to reopen if needed.

Note: See TracTickets for help on using tickets.