[wp-trac] [WordPress Trac] #6518: Shortcode escaping

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 1 00:28:07 GMT 2008


#6518: Shortcode escaping
-------------------------+--------------------------------------------------
 Reporter:  tellyworth   |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.5.1    
Component:  General      |     Version:  2.5      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------
 In 2.5.0 there's no official syntax for escaping a shortcode.  This makes
 it difficult to write a post that gives examples of shortcode usage:

 {{{
 Here's how to use the [gallery] tag...
 }}}

 It's possible to work around it by using HTML entities to represent the
 square brackets but that's ugly.

 The enclosed patch improves the shortcode parser to support an escaping
 syntax:

 {{{
 Here's how to use the [[gallery]] tag...
 }}}

 The output looks like this, with the extra brackets removed:

 {{{
 Here's how to use the [gallery] tag...
 }}}

 It only affects valid shortcode tags, so {{{[[not-a-tag]]}}} displays the
 input unmodified.

 I have unit tested it for common cases including invalid escaping syntax
 with unbalanced brackets (test_tag_escaped() and test_tag_not_escaped()):

 http://svn.automattic.com/wordpress-tests/wp-testcase/test_shortcode.php

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6518>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list