[wp-trac] [WordPress Trac] #18311: Support HTML in image captions.

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 16 20:42:36 UTC 2012


#18311: Support HTML in image captions.
--------------------------------------+-----------------------
 Reporter:  prettyboymp               |       Owner:  sushkov
     Type:  task (blessed)            |      Status:  assigned
 Priority:  normal                    |   Milestone:  3.4
Component:  Editor                    |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  ux-feedback dev-feedback  |
--------------------------------------+-----------------------

Comment (by sushkov):

 Here's another approach we were proposing during last dev-chat, for
 handling caption text.

 Right now the shortcode looks like this:

 {{{ [caption id="attachment_7" align="alignleft" width="300"
 caption="Caption Text"]<img src="pic.jpg" width="300" height="199"
 />[/caption] }}}

 Because changes to handle captions inside an attribute will result in less
 simple and clear code, we can move the caption text into its own
 shortcode:

 {{{ [caption id="attachment_7" align="alignleft" width="300"
 caption="ceva"]<img src="pic.jpg" width="300" height="199"
 />[caption_text]Caption Text[/caption_text][/caption] }}}

 This basically saves us from handling input and escaping data from an
 attribute, and leaves space for all kind of formatting.

 In fact, looking back, we can solve this simply by regexp-ing `img` tag
 and considering the rest `caption text` (problem here is that themes that
 hook into `img_caption_shortcode` will have no support for the new version
 of captions text).

 This snippet more or less shows the current shortcode version changes it
 will require:
 https://gist.github.com/1847575

 The point of the above snippet, is to prove that backcompat can be
 preserved.

 Once again, changes on the JS side, should be less and cleaner with an
 approach like this.

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


More information about the wp-trac mailing list