[wp-trac] [WordPress Trac] #19855: Too much text in <pre> tag causes no output

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 13 23:29:24 UTC 2012


#19855: Too much text in <pre> tag causes no output
--------------------------+------------------------------
 Reporter:  helenyhou     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  1.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by azaozz):

 Replying to [comment:10 kurtpayne]:
 > ...
 > The top line is missing a closing `</p>` tag.
 >
 > In [[attachment:19855-3.patch]] I added this:
 >
 > {{{
 > $pee = str_ireplace( '<pre', "\n\n<pre", $pee );
 > }}}
 >
 > to ensure that all `<pre>` tags have sufficient whitespace to be
 processed normally.

 Yes, the <pre> is a block tag so when typing in the HTML editor it has to
 have a line break before opening and after closing. That's how it comes
 out of the Visual editor too. There are more edge cases with other block
 tags similar to this one, perhaps they can be fixed all together.

 On the other hand when using the HTML editor it assumes the user is aware
 that block tags have to be treated as blocks of text, i.e. "\n\n" before
 the opening tag and after the closing tag. That's the whole point of the
 HTML editor: it lets you use HTML code but still has an easy to read,
 "natural" layout.

 Replying to [comment:11 kurtpayne]:
 > On second thought ... is there a reason we couldn't pass `$pee` through
 `force_balance_tags()`...

 Not a good idea imho, `force_balance_tags()` is (mostly) for the comments
 and can't handle more complex HTML.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19855#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list