WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#2239 closed defect (bug) (fixed)

Nested pre/blockquote in li produces invalid XHTML

Reported by: Juergen Owned by: pishmishy
Milestone: 2.6.1 Priority: normal
Severity: normal Version: 2.0
Component: General Keywords: has-patch formatting wpautop xhtml
Focuses: 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 (1)

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

Download all attachments as: .zip

Change History (10)

comment:1 jhodgdon7 years ago

  • 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...

comment:2 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:3 ryan7 years ago

  • Milestone changed from 2.3 to 2.4

comment:4 pishmishy6 years ago

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

comment:5 pishmishy6 years ago

  • 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.

comment:6 pishmishy6 years ago

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

comment:7 pishmishy6 years ago

Still present in trunk.

pishmishy6 years ago

freshened patch (woops)

comment:8 pishmishy6 years ago

  • Keywords xhtml added

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

comment:9 azaozz6 years ago

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

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.