[wp-trac] Re: [WordPress Trac] #6969: Don't apply wptexturize() to the insides of shortcode tags

WordPress Trac wp-trac at lists.automattic.com
Mon May 4 16:13:07 GMT 2009


#6969: Don't apply wptexturize() to the insides of shortcode tags
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |       Owner:  tellyworth                          
     Type:  enhancement   |      Status:  new                                 
 Priority:  normal        |   Milestone:  Future Release                      
Component:  Formatting    |     Version:  2.5.1                               
 Severity:  normal        |    Keywords:  needs-patch 2nd-opinion dev-feedback
--------------------------+-------------------------------------------------
Changes (by Denis-de-Bernardy):

  * keywords:  has-patch needs-testing => needs-patch 2nd-opinion dev-
               feedback
  * milestone:  2.8 => Future Release


Comment:

 @mzizka: here are a few nasty tests case to play with:

 {{{
 foo[caption id="attachment_31" align="alignleft" width="215"
 caption="&quot;foo&quot;"]<img class="size-full wp-image-31" title="test2"
 src="http://localhost/~denis/wp/wp-content/uploads/2009/04/test2.jpg"
 alt="&quot;foo&quot;" width="215" height="300" />"bar&quot;[/caption]bar
 }}}

 currently outputs (with your patch):

 {{{
 <p>foo<div id="attachment_31" class="wp-caption alignleft" style="width:
 225px"><img class="size-full wp-image-31" title="test2"
 src="http://localhost/~denis/wp/wp-content/uploads/2009/04/test2.jpg"
 alt="&quot;foo&quot;" width="215" height="300" />"bar&quot;<p class="wp-
 caption-text">&quot;foo&quot;</p></div>bar</p>
 }}}


 expected, either of:

 {{{
 <p>foo<div id="attachment_31" class="wp-caption alignleft" style="width:
 225px"><img class="size-full wp-image-31" title="test2"
 src="http://localhost/~denis/wp/wp-content/uploads/2009/04/test2.jpg"
 alt="&quot;foo&quot;" width="215" height="300" />&#8221;bar&#8243;<p class
 ="wp-caption-text">&quot;foo&quot;</p></div>bar</p>

 <p>foo<div id="attachment_31" class="wp-caption alignleft" style="width:
 225px"><img class="size-full wp-image-31" title="test2"
 src="http://localhost/~denis/wp/wp-content/uploads/2009/04/test2.jpg"
 alt="&quot;foo&quot;" width="215" height="300" />"bar&quot;<p class="wp-
 caption-text">&quot;foo&quot;</p></div>bar</p>
 }}}

 the same shortcode, but this time escaped:

 {{{
 [[caption id="attachment_31" align="alignleft" width="215"
 caption="&quot;foo&quot;"]<img class="size-full wp-image-31" title="test2"
 src="http://localhost/~denis/wp/wp-content/uploads/2009/04/test2.jpg"
 alt="&quot;foo&quot;" width="215" height="300" />"bar&quot;[/caption]]
 }}}

 currently outputs:

 {{{
 [caption id=&#8221;attachment_31&#8243; align=&#8221;alignleft&#8221;
 width=&#8221;215&#8243; caption=&#8221;&quot;foo&quot;&#8221;]<img class
 ="size-full wp-image-31" title="test2" src="http://localhost/~denis/wp/wp-
 content/uploads/2009/04/test2.jpg" alt="&quot;foo&quot;" width="215"
 height="300" />&#8220;bar&#8221;[/caption]
 }}}

 expected, either of:

 {{{
 [caption id=&quot;attachment_31&quot; align=&quot;alignleft&quot;
 width=&quot;215&quot; caption=&quot;&quot;foo&quot;&quot;]<img class
 ="size-full wp-image-31" title="test2" src="http://localhost/~denis/wp/wp-
 content/uploads/2009/04/test2.jpg" alt="&quot;foo&quot;" width="215"
 height="300" />&quot;bar&amp;quot;[/caption]

 [caption id=&quot;attachment_31&quot; align=&quot;alignleft&quot;
 width=&quot;215&quot; caption=&quot;&quot;foo&quot;&quot;]<img class
 ="size-full wp-image-31" title="test2" src="http://localhost/~denis/wp/wp-
 content/uploads/2009/04/test2.jpg" alt="&quot;foo&quot;" width="215"
 height="300" />"bar&quot;[/caption]
 }}}

 itching to close this as invalid or wontfix, myself. or then, we'd want to
 add some kind of special attribute that *tells* texturize what to do.

 the reason is, in above, the outlined expected results could all be
 expected. I used the caption shortcode from lack of a plugin around that
 used shortcodes, but:

  - on occasion, you'll actually want the texturizing
  - on occasion, you're writing php code and don't want it to change a
 thing
  - on occasion, you're writing about shortcodes, using the escape method
 that was recently implemented, and you expect *some* texturizing to happen
 (as is done in code block). in this case the shortcode arguably gets
 nested into a <pre> or <code> block (haven't tried that)

 moving this to future pending dev feedback

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


More information about the wp-trac mailing list