WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 9 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 10 years ago.
freshened patch (woops)

Download all attachments as: .zip

Change History (10)

#1 @jhodgdon
11 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...

#2 @foolswisdom
11 years ago

  • Milestone changed from 2.2 to 2.3

#3 @ryan
10 years ago

  • Milestone changed from 2.3 to 2.4

#4 @pishmishy
10 years ago

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

#5 @pishmishy
10 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.

#6 @pishmishy
10 years ago

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

#7 @pishmishy
10 years ago

Still present in trunk.

@pishmishy
10 years ago

freshened patch (woops)

#8 @pishmishy
10 years ago

  • Keywords xhtml added

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

#9 @azaozz
9 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.