Both the issues #934844: Support WordPress [caption] syntax (implement full quicktags.inc file) and #739798: Using Caption Filter to migrate captions from Wordpress deal with the fact that Caption Filter doesn't properly handle [caption] tags when there are quotes in the syntax, such as [caption align="right"] instead of [caption align=right]. Unfortunately WordPress now includes quotes in its syntax by default, which makes migrating WordPress data more difficult and throws off user expectations.

Also of interest, WordPress now actually uses a syntax such as caption align="alignright"] (instead of just "right"), and we might want to take that into consideration also if we're not already.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Active » Fixed
FileSize
3.42 KB
3.43 KB

I've taken a partial suggestion from #934844: Support WordPress [caption] syntax (implement full quicktags.inc file) and utilized the WordPress function for shortcode_parse_atts() in this patch. This function is responsible for taking the attributes string and turning it into an array of attributes. It handles single quotes, double quotes, no quotes at all, and attributes that are merely single words (i.e. "checked" in HTML4) and parses them all nicely into an array.

This is a bit much for what we need currently, since we only support one attribute ("align"), but it does solve immediate problems with our implementation such as the align attribute only working without quotes or breaking if there were more than one space between the opening [caption tag and the attribute "align". In any case I think it's a good move for us to bring ourselves inline with the functionality we're imitating as much as possible.

I've committed this patch to both D6 and D7 branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.