wp/wp-includes/js/dist/shortcode.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-includes/js/dist/shortcode.js	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/js/dist/shortcode.js	Wed Sep 21 18:19:35 2022 +0200
@@ -82,19 +82,12 @@
 /******/
 /******/
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 431);
+/******/ 	return __webpack_require__(__webpack_require__.s = "/2FX");
 /******/ })
 /************************************************************************/
 /******/ ({
 
-/***/ 2:
-/***/ (function(module, exports) {
-
-(function() { module.exports = this["lodash"]; }());
-
-/***/ }),
-
-/***/ 431:
+/***/ "/2FX":
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -105,9 +98,9 @@
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "regexp", function() { return regexp; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "attrs", function() { return attrs; });
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMatch", function() { return fromMatch; });
-/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
+/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("YLtl");
 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60);
+/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("4eJC");
 /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__);
 /**
  * External dependencies
@@ -153,11 +146,10 @@
  * @return {?WPShortcodeMatch} Matched information.
  */
 
-function next(tag, text) {
-  var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
-  var re = regexp(tag);
+function next(tag, text, index = 0) {
+  const re = regexp(tag);
   re.lastIndex = index;
-  var match = re.exec(text);
+  const match = re.exec(text);
 
   if (!match) {
     return;
@@ -168,7 +160,7 @@
     return next(tag, text, re.lastIndex);
   }
 
-  var result = {
+  const result = {
     index: match.index,
     content: match[0],
     shortcode: fromMatch(match)
@@ -207,10 +199,10 @@
     } // Create the match object and pass it through the callback.
 
 
-    var result = callback(fromMatch(arguments)); // Make sure to return any of the extra brackets if they weren't used to
+    const result = callback(fromMatch(arguments)); // Make sure to return any of the extra brackets if they weren't used to
     // escape the shortcode.
 
-    return result ? left + result + right : match;
+    return result || result === '' ? left + result + right : match;
   });
 }
 /**
@@ -272,9 +264,9 @@
  * @return {WPShortcodeAttrs} Parsed shortcode attributes.
  */
 
-var attrs = memize__WEBPACK_IMPORTED_MODULE_1___default()(function (text) {
-  var named = {};
-  var numeric = []; // This regular expression is reused from `shortcode_parse_atts()` in
+const attrs = memize__WEBPACK_IMPORTED_MODULE_1___default()(text => {
+  const named = {};
+  const numeric = []; // This regular expression is reused from `shortcode_parse_atts()` in
   // `wp-includes/shortcodes.php`.
   //
   // Capture groups:
@@ -289,10 +281,10 @@
   // 8. A numeric attribute in single quotes.
   // 9. An unquoted numeric attribute.
 
-  var pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g; // Map zero-width spaces to actual spaces.
+  const pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g; // Map zero-width spaces to actual spaces.
 
   text = text.replace(/[\u00a0\u200b]/g, ' ');
-  var match; // Match and normalize attributes.
+  let match; // Match and normalize attributes.
 
   while (match = pattern.exec(text)) {
     if (match[1]) {
@@ -311,8 +303,8 @@
   }
 
   return {
-    named: named,
-    numeric: numeric
+    named,
+    numeric
   };
 });
 /**
@@ -328,7 +320,7 @@
  */
 
 function fromMatch(match) {
-  var type;
+  let type;
 
   if (match[4]) {
     type = 'self-closing';
@@ -341,7 +333,7 @@
   return new shortcode({
     tag: match[2],
     attrs: match[3],
-    type: type,
+    type,
     content: match[5]
   });
 }
@@ -358,11 +350,9 @@
  * @return {WPShortcode} Shortcode instance.
  */
 
-var shortcode = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["extend"])(function (options) {
-  var _this = this;
-
+const shortcode = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["extend"])(function (options) {
   Object(lodash__WEBPACK_IMPORTED_MODULE_0__["extend"])(this, Object(lodash__WEBPACK_IMPORTED_MODULE_0__["pick"])(options || {}, 'tag', 'attrs', 'type', 'content'));
-  var attributes = this.attrs; // Ensure we have a correctly formatted `attrs` object.
+  const attributes = this.attrs; // Ensure we have a correctly formatted `attrs` object.
 
   this.attrs = {
     named: {},
@@ -379,17 +369,17 @@
   } else if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isEqual"])(Object.keys(attributes), ['named', 'numeric'])) {
     this.attrs = attributes; // Handle a flat object of attributes.
   } else {
-    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(attributes, function (value, key) {
-      _this.set(key, value);
+    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(attributes, (value, key) => {
+      this.set(key, value);
     });
   }
 }, {
-  next: next,
-  replace: replace,
-  string: string,
-  regexp: regexp,
-  attrs: attrs,
-  fromMatch: fromMatch
+  next,
+  replace,
+  string,
+  regexp,
+  attrs,
+  fromMatch
 });
 Object(lodash__WEBPACK_IMPORTED_MODULE_0__["extend"])(shortcode.prototype, {
   /**
@@ -402,7 +392,7 @@
    *
    * @return {string} Attribute value.
    */
-  get: function get(attr) {
+  get(attr) {
     return this.attrs[Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(attr) ? 'numeric' : 'named'][attr];
   },
 
@@ -417,7 +407,7 @@
    *
    * @return {WPShortcode} Shortcode instance.
    */
-  set: function set(attr, value) {
+  set(attr, value) {
     this.attrs[Object(lodash__WEBPACK_IMPORTED_MODULE_0__["isNumber"])(attr) ? 'numeric' : 'named'][attr] = value;
     return this;
   },
@@ -427,16 +417,16 @@
    *
    * @return {string} String representation of the shortcode.
    */
-  string: function string() {
-    var text = '[' + this.tag;
-    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(this.attrs.numeric, function (value) {
+  string() {
+    let text = '[' + this.tag;
+    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(this.attrs.numeric, value => {
       if (/\s/.test(value)) {
         text += ' "' + value + '"';
       } else {
         text += ' ' + value;
       }
     });
-    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(this.attrs.named, function (value, name) {
+    Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(this.attrs.named, (value, name) => {
       text += ' ' + name + '="' + value + '"';
     }); // If the tag is marked as `single` or `self-closing`, close the tag and
     // ignore any additional content.
@@ -457,13 +447,14 @@
 
     return text + '[/' + this.tag + ']';
   }
+
 });
 /* harmony default export */ __webpack_exports__["default"] = (shortcode);
 
 
 /***/ }),
 
-/***/ 60:
+/***/ "4eJC":
 /***/ (function(module, exports, __webpack_require__) {
 
 /**
@@ -629,6 +620,13 @@
 module.exports = memize;
 
 
+/***/ }),
+
+/***/ "YLtl":
+/***/ (function(module, exports) {
+
+(function() { module.exports = window["lodash"]; }());
+
 /***/ })
 
 /******/ })["default"];
\ No newline at end of file