[wp-trac] [WordPress Trac] #45493: Square brackets in caption shortcode produce improper formatting

WordPress Trac noreply at wordpress.org
Wed Dec 5 21:29:24 UTC 2018


#45493: Square brackets in caption shortcode produce improper formatting
---------------------------+-----------------------------
 Reporter:  Christian1012  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Editor         |    Version:  4.9.8
 Severity:  normal         |   Keywords:  needs-patch
  Focuses:                 |
---------------------------+-----------------------------
 If [square] brackets are placed inside of a
 {{{
 [caption]
 }}}
 shortcode, the resulting formatting is broken when the captioned image is
 surrounded by text content.

 If you paste the following into the text editor, switch to visual, and
 then back to text, you'll notice the line break after the caption
 disappears.

 {{{
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
 voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
 clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
 amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
 nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
 diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
 Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
 sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
 diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
 erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
 rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
 dolor sit amet.

 [caption id="attachment_143591" align="aligncenter" width="700"]<img class
 ="size-full wp-image-143591" src="https://placehold.it/700x800" alt=""
 width="700" height="800" /> This is a caption with some [square] braces
 that make it appear like another shortcode.[/caption]

 Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse
 molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero
 eros et accumsan et iusto odio dignissim qui blandit praesent luptatum
 zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum
 dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
 euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
 }}}

 I'm not sure why this is happening, it may be related to some code
 thinking that the square brace inside the caption indicates it may be
 another shortcode.  Escaping the shortcode using double brackets didn't
 have any affect.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45493>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list