| @@ -9,17 +9,17 @@ | ||
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Converts a set of named and numeric Shortcode attributes to a string. |
| 12 | 12 | * |
| 13 | - * This function is similar to @wordpress/shortcode's `string()` function, | |
| 13 | + * This function is similar to `@wordpress/shortcode`'s `string()` function, | |
| 14 | 14 | * but only returns the attributes string and not a full Shortcode. |
| 15 | 15 | * |
| 16 | 16 | * @param {Object} shortcodeAttrs The named and numeric Shortcode attributes. |
| 17 | 17 | * @return {string} The attributes as a key=value string. |
| 18 | 18 | */ |
| 19 | -export const shortcode_attrs_to_string = ( shortcodeAttrs ) => { | |
| 19 | +export const shortcodeAttrsToString = ( shortcodeAttrs ) => { | |
| 20 | 20 | // Convert named attributes. |
| 21 | - let shortcode_attrs_string = Object.entries( shortcodeAttrs.named ).map( ( [ attribute, value ] ) => { | |
| 21 | + let shortcodeAttrsString = Object.entries( shortcodeAttrs.named ).map( ( [ attribute, value ] ) => { | |
| 22 | 22 | let enclose = ''; // Don't enclose values by default. |
| 23 | 23 | |
| 24 | 24 | // Remove curly quotation marks around a value. |
| 25 | 25 | value = value.replace( /“([^”]*)”/g, '$1' ); |
| @@ -39,12 +39,12 @@ | ||
| 39 | 39 | |
| 40 | 40 | // Convert numeric attributes. |
| 41 | 41 | shortcodeAttrs.numeric.forEach( ( value ) => { |
| 42 | 42 | if ( /\s/.test( value ) ) { |
| 43 | - shortcode_attrs_string += ' "' + value + '"'; | |
| 43 | + shortcodeAttrsString += ' "' + value + '"'; | |
| 44 | 44 | } else { |
| 45 | - shortcode_attrs_string += ' ' + value; | |
| 45 | + shortcodeAttrsString += ' ' + value; | |
| 46 | 46 | } |
| 47 | 47 | } ); |
| 48 | 48 | |
| 49 | - return shortcode_attrs_string; | |
| 49 | + return shortcodeAttrsString; | |
| 50 | 50 | }; |