diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/js/dist/autop.js --- a/wp/wp-includes/js/dist/autop.js Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/js/dist/autop.js Fri Sep 05 18:40:08 2025 +0200 @@ -1,43 +1,43 @@ -/******/ (function() { // webpackBootstrap +/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ -/******/ !function() { +/******/ (() => { /******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { +/******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; -/******/ }(); +/******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ -/******/ !function() { +/******/ (() => { /******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { +/******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; -/******/ }(); +/******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "autop": function() { return /* binding */ autop; }, -/* harmony export */ "removep": function() { return /* binding */ removep; } +/* harmony export */ autop: () => (/* binding */ autop), +/* harmony export */ removep: () => (/* binding */ removep) /* harmony export */ }); /** * The regular expression for an HTML element. @@ -46,34 +46,54 @@ */ const htmlSplitRegex = (() => { /* eslint-disable no-multi-spaces */ - const comments = '!' + // Start of comment, after the <. - '(?:' + // Unroll the loop: Consume everything until --> is found. - '-(?!->)' + // Dash not followed by end of comment. - '[^\\-]*' + // Consume non-dashes. - ')*' + // Loop possessively. + const comments = '!' + + // Start of comment, after the <. + '(?:' + + // Unroll the loop: Consume everything until --> is found. + '-(?!->)' + + // Dash not followed by end of comment. + '[^\\-]*' + + // Consume non-dashes. + ')*' + + // Loop possessively. '(?:-->)?'; // End of comment. If not found, match all input. - const cdata = '!\\[CDATA\\[' + // Start of comment, after the <. - '[^\\]]*' + // Consume non-]. - '(?:' + // Unroll the loop: Consume everything until ]]> is found. - '](?!]>)' + // One ] not followed by end of comment. - '[^\\]]*' + // Consume non-]. - ')*?' + // Loop possessively. + const cdata = '!\\[CDATA\\[' + + // Start of comment, after the <. + '[^\\]]*' + + // Consume non-]. + '(?:' + + // Unroll the loop: Consume everything until ]]> is found. + '](?!]>)' + + // One ] not followed by end of comment. + '[^\\]]*' + + // Consume non-]. + ')*?' + + // Loop possessively. '(?:]]>)?'; // End of comment. If not found, match all input. - const escaped = '(?=' + // Is the element escaped? - '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type? + const escaped = '(?=' + + // Is the element escaped? + '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + + // If yes, which type? comments + '|' + cdata + ')'; - const regex = '(' + // Capture the entire match. - '<' + // Find start of element. - '(' + // Conditional expression follows. - escaped + // Find end of escaped element. - '|' + // ... else ... - '[^>]*>?' + // Find end of normal element. + const regex = '(' + + // Capture the entire match. + '<' + + // Find start of element. + '(' + + // Conditional expression follows. + escaped + + // Find end of escaped element. + '|' + + // ... else ... + '[^>]*>?' + + // Find end of normal element. ')' + ')'; return new RegExp(regex); /* eslint-enable no-multi-spaces */ })(); + /** * Separate HTML elements and comments from the text. * @@ -81,32 +101,26 @@ * * @return {string[]} The formatted text. */ - - function htmlSplit(input) { const parts = []; let workingInput = input; let match; - while (match = workingInput.match(htmlSplitRegex)) { // The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`. // If the `g` flag is omitted, `index` is included. // `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number. // Assert `match.index` is a number. - const index = - /** @type {number} */ - match.index; + const index = /** @type {number} */match.index; parts.push(workingInput.slice(0, index)); parts.push(match[0]); workingInput = workingInput.slice(index + match[0].length); } - if (workingInput.length) { parts.push(workingInput); } - return parts; } + /** * Replace characters or phrases within HTML elements only. * @@ -115,34 +129,32 @@ * * @return {string} The formatted text. */ - - function replaceInHtmlTags(haystack, replacePairs) { // Find all elements. const textArr = htmlSplit(haystack); - let changed = false; // Extract all needles. + let changed = false; - const needles = Object.keys(replacePairs); // Loop through delimiters (elements) only. + // Extract all needles. + const needles = Object.keys(replacePairs); + // Loop through delimiters (elements) only. for (let i = 1; i < textArr.length; i += 2) { for (let j = 0; j < needles.length; j++) { const needle = needles[j]; - if (-1 !== textArr[i].indexOf(needle)) { textArr[i] = textArr[i].replace(new RegExp(needle, 'g'), replacePairs[needle]); - changed = true; // After one strtr() break out of the foreach loop and look at next element. - + changed = true; + // After one strtr() break out of the foreach loop and look at next element. break; } } } - if (changed) { haystack = textArr.join(''); } - return haystack; } + /** * Replaces double line-breaks with paragraph elements. * @@ -162,146 +174,159 @@ * * @return {string} Text which has been converted into paragraph tags. */ - - -function autop(text) { - let br = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; +function autop(text, br = true) { const preTags = []; - if (text.trim() === '') { return ''; - } // Just to make things a little easier, pad the end. + } + // Just to make things a little easier, pad the end. + text = text + '\n'; - text = text + '\n'; /* * Pre tags shouldn't be touched by autop. * Replace pre tags with placeholders and bring them back after autop. */ - if (text.indexOf('
'); const lastText = textParts.pop(); text = ''; - for (let i = 0; i < textParts.length; i++) { const textPart = textParts[i]; - const start = textPart.indexOf(''; preTags.push([name, textPart.substr(start) + '']); text += textPart.substr(0, start) + name; } - text += lastText; - } // Change multiple