[wp-trac] Re: [WordPress Trac] #4857: More issues with wpautop()

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 27 20:44:58 GMT 2007


#4857: More issues with wpautop()
---------------------------------+------------------------------------------
 Reporter:  Viper007Bond         |        Owner:  mdawaffe
     Type:  defect               |       Status:  assigned
 Priority:  low                  |    Milestone:  2.4     
Component:  Template             |      Version:  2.3     
 Severity:  normal               |   Resolution:          
 Keywords:  wpautop needs-patch  |  
---------------------------------+------------------------------------------
Comment (by whoismanu):

 Replying to [ticket:4857 Viper007Bond]:
 > ''Not sure if this should slide into 2.3 or if it can wait for 2.4.
 Change as need be.''
 >
 > `wpautop()` has issues with closing `</p>`'s when it comes to HTML.
 >
 > For example:
 >
 > {{{
 > Foo<div>Bar</div>
 > }}}
 >
 > Results in:
 >
 > {{{
 > <p>Foo
 > <div>Bar</div>
 > }}}


 obviously it didn't make it into 2.3 ;-( let's hope it will make it into
 2.4. here is a real world example from my photoblog plugin. i hope it
 shows that the problem really is annoying whenever there is need to have
 some structured content in the content section of the post. i of course
 also hope it could help raise the priority level of this one ;-). so here
 you go:

 my plugin writes an image plus a corresponding description into the post
 like this:


 {{{
 <img width="700" height="525" src="someimage.jpg" />
 <p class="description">Description of image</p>
 }}}

 The p tag with css class is needed to give the user the possibility to
 style the result. so i cannot just use line breaks between the image and
 its description like the wordpress editor would do to separate paragraphs.

 The result after it has been deformed by wpautop:


 {{{
 <p><img width="700" height="525" src="someimage.jpg" />
 <p class="description">Description of image</p>
 }}}

 which is obviously not valid xhtml. what i would expect is


 {{{
 <img width="700" height="525" src="someimage.jpg" />
 <p class="description">Description of image</p>
 }}}

 or if you really have to put p tags all over the place:


 {{{
 <p><img width="700" height="525" src="someimage.jpg" /></p>
 <p class="description">Description of image</p>
 }}}

 yes, the paragraph should not wrap the whole thing because of the reason
 you mention. yes, the bug concerns all blocklevel elements, so


 {{{
 <img width="700" height="525" src="someimage.jpg" />
 <div class="description">Description of image</div>
 }}}

 results in

 {{{
 <p><img width="700" height="525" src="someimage.jpg" />
 <div class="description">Description of image</div>
 }}}

 thanks a lot for fixing this.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4857#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list