[wp-trac] [WordPress Trac] #18776: balanceTags should ignore shortcodes & their content

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 26 11:26:10 UTC 2011


#18776: balanceTags should ignore shortcodes & their content
--------------------------+-----------------------------
 Reporter:  ciantic       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Take following input:

 {{{
 something [myshortcode]<b>[/myshortcode]
 }}}

 after `balanceTags()` it becomes:

 {{{
 something [myshortcode]<b>[/myshortcode]</b>
 }}}

 Well, this is not what the shortcode creator probably wanted.

 '''Proposed fixes:'''

 If you are feeling lazy: Convert `[.*]` to `<$1>` and since balanceTags
 handles XML it should work, afterwards convert appropriate `<>` back to
 `[]`. Though this does not give a shortcode creator chance to disallow
 balancing tags inside it's content which is bad.

 Better fix is to allow shortcode creators to decide wether their contents
 should be balanced:

 1. `balanceTags()` should ignore all shortcodes and their contents.
 2. Parse all shortcodes in content and on each shortcode call apply filter
 on so that shortcode creator can hook (if sees it appropriate) on to that.
 Shortcode creator then can call `balanceTags()` in his filter of that
 shortcode in order to run `balanceTags()` ''contents of shortcode''
 separately if wanted.

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


More information about the wp-trac mailing list