X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/256a3b381f63716209b3527d0a14442ae570c283..HEAD:/wp-includes/js/shortcode.js diff --git a/wp-includes/js/shortcode.js b/wp-includes/js/shortcode.js index 677c99a5..79423eec 100644 --- a/wp-includes/js/shortcode.js +++ b/wp-includes/js/shortcode.js @@ -1,4 +1,4 @@ -// Utility functions for parsing and handling shortcodes in Javascript. +// Utility functions for parsing and handling shortcodes in JavaScript. // Ensure the global `wp` object exists. window.wp = window.wp || {}; @@ -37,13 +37,13 @@ window.wp = window.wp || {}; // If we matched a leading `[`, strip it from the match // and increment the index accordingly. if ( match[1] ) { - result.match = result.match.slice( 1 ); + result.content = result.content.slice( 1 ); result.index++; } // If we matched a trailing `]`, strip it from the match. if ( match[7] ) { - result.match = result.match.slice( 0, -1 ); + result.content = result.content.slice( 0, -1 ); } return result; @@ -135,7 +135,7 @@ window.wp = window.wp || {}; // 6. an unquoted value. // 7. A numeric attribute in double quotes. // 8. An unquoted numeric attribute. - pattern = /(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/g; + pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/g; // Map zero-width spaces to actual spaces. text = text.replace( /[\u00a0\u200b]/g, ' ' ); @@ -326,11 +326,6 @@ window.wp = window.wp || {}; _.each( options.attrs, function( value, attr ) { text += ' ' + attr; - // Use empty attribute notation where possible. - if ( '' === value ) { - return; - } - // Convert boolean values to strings. if ( _.isBoolean( value ) ) { value = value ? 'true' : 'false'; @@ -353,4 +348,4 @@ window.wp = window.wp || {}; return text + ''; } }); -}()); \ No newline at end of file +}());