Diff: STRATO-apps/wordpress_03/app/wp-includes/js/dist/autop.js
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
/******/ (() => { // webpackBootstrap
2
+
/******/ "use strict";
3
+
/******/ // The require scope
4
+
/******/ var __webpack_require__ = {};
5
+
/******/
6
+
/************************************************************************/
7
+
/******/ /* webpack/runtime/define property getters */
8
+
/******/ (() => {
9
+
/******/ // define getter functions for harmony exports
10
+
/******/ __webpack_require__.d = (exports, definition) => {
11
+
/******/ for(var key in definition) {
12
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14
+
/******/ }
15
+
/******/ }
16
+
/******/ };
17
+
/******/ })();
18
+
/******/
19
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
20
+
/******/ (() => {
21
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22
+
/******/ })();
23
+
/******/
24
+
/******/ /* webpack/runtime/make namespace object */
25
+
/******/ (() => {
26
+
/******/ // define __esModule on exports
27
+
/******/ __webpack_require__.r = (exports) => {
28
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30
+
/******/ }
31
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
32
+
/******/ };
33
+
/******/ })();
34
+
/******/
35
+
/************************************************************************/
36
+
var __webpack_exports__ = {};
37
+
__webpack_require__.r(__webpack_exports__);
38
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
39
+
/* harmony export */ autop: () => (/* binding */ autop),
40
+
/* harmony export */ removep: () => (/* binding */ removep)
41
+
/* harmony export */ });
42
+
const htmlSplitRegex = (() => {
43
+
const comments = "!(?:-(?!->)[^\\-]*)*(?:-->)?";
44
+
const cdata = "!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?";
45
+
const escaped = "(?=!--|!\\[CDATA\\[)((?=!-)" + // If yes, which type?
46
+
comments + "|" + cdata + ")";
47
+
const regex = "(<(" + // Conditional expression follows.
48
+
escaped + // Find end of escaped element.
49
+
"|[^>]*>?))";
50
+
return new RegExp(regex);
51
+
})();
52
+
function htmlSplit(input) {
53
+
const parts = [];
54
+
let workingInput = input;
55
+
let match;
56
+
while (match = workingInput.match(htmlSplitRegex)) {
57
+
const index = match.index;
58
+
parts.push(workingInput.slice(0, index));
59
+
parts.push(match[0]);
60
+
workingInput = workingInput.slice(index + match[0].length);
61
+
}
62
+
if (workingInput.length) {
63
+
parts.push(workingInput);
64
+
}
65
+
return parts;
66
+
}
67
+
function replaceInHtmlTags(haystack, replacePairs) {
68
+
const textArr = htmlSplit(haystack);
69
+
let changed = false;
70
+
const needles = Object.keys(replacePairs);
71
+
for (let i = 1; i < textArr.length; i += 2) {
72
+
for (let j = 0; j < needles.length; j++) {
73
+
const needle = needles[j];
74
+
if (-1 !== textArr[i].indexOf(needle)) {
75
+
textArr[i] = textArr[i].replace(
76
+
new RegExp(needle, "g"),
77
+
replacePairs[needle]
78
+
);
79
+
changed = true;
80
+
break;
81
+
}
82
+
}
83
+
}
84
+
if (changed) {
85
+
haystack = textArr.join("");
86
+
}
87
+
return haystack;
88
+
}
89
+
function autop(text, br = true) {
90
+
const preTags = [];
91
+
if (text.trim() === "") {
92
+
return "";
93
+
}
94
+
text = text + "\n";
95
+
if (text.indexOf("<pre") !== -1) {
96
+
const textParts = text.split("</pre>");
97
+
const lastText = textParts.pop();
98
+
text = "";
99
+
for (let i = 0; i < textParts.length; i++) {
100
+
const textPart = textParts[i];
101
+
const start = textPart.indexOf("<pre");
102
+
if (start === -1) {
103
+
text += textPart;
104
+
continue;
105
+
}
106
+
const name = "<pre wp-pre-tag-" + i + "></pre>";
107
+
preTags.push([name, textPart.substr(start) + "</pre>"]);
108
+
text += textPart.substr(0, start) + name;
109
+
}
110
+
text += lastText;
111
+
}
112
+
text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, "\n\n");
113
+
const allBlocks = "(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";
114
+
text = text.replace(
115
+
new RegExp("(<" + allBlocks + "[\\s/>])", "g"),
116
+
"\n\n$1"
117
+
);
118
+
text = text.replace(
119
+
new RegExp("(</" + allBlocks + ">)", "g"),
120
+
"$1\n\n"
121
+
);
122
+
text = text.replace(/\r\n|\r/g, "\n");
123
+
text = replaceInHtmlTags(text, { "\n": " <!-- wpnl --> " });
124
+
if (text.indexOf("<option") !== -1) {
125
+
text = text.replace(/\s*<option/g, "<option");
126
+
text = text.replace(/<\/option>\s*/g, "</option>");
127
+
}
128
+
if (text.indexOf("</object>") !== -1) {
129
+
text = text.replace(/(<object[^>]*>)\s*/g, "$1");
130
+
text = text.replace(/\s*<\/object>/g, "</object>");
131
+
text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, "$1");
132
+
}
133
+
if (text.indexOf("<source") !== -1 || text.indexOf("<track") !== -1) {
134
+
text = text.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g, "$1");
135
+
text = text.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g, "$1");
136
+
text = text.replace(/\s*(<(?:source|track)[^>]*>)\s*/g, "$1");
137
+
}
138
+
if (text.indexOf("<figcaption") !== -1) {
139
+
text = text.replace(/\s*(<figcaption[^>]*>)/, "$1");
140
+
text = text.replace(/<\/figcaption>\s*/, "</figcaption>");
141
+
}
142
+
text = text.replace(/\n\n+/g, "\n\n");
143
+
const texts = text.split(/\n\s*\n/).filter(Boolean);
144
+
text = "";
145
+
texts.forEach((textPiece) => {
146
+
text += "<p>" + textPiece.replace(/^\n*|\n*$/g, "") + "</p>\n";
147
+
});
148
+
text = text.replace(/<p>\s*<\/p>/g, "");
149
+
text = text.replace(
150
+
/<p>([^<]+)<\/(div|address|form)>/g,
151
+
"<p>$1</p></$2>"
152
+
);
153
+
text = text.replace(
154
+
new RegExp("<p>\\s*(</?" + allBlocks + "[^>]*>)\\s*</p>", "g"),
155
+
"$1"
156
+
);
157
+
text = text.replace(/<p>(<li.+?)<\/p>/g, "$1");
158
+
text = text.replace(/<p><blockquote([^>]*)>/gi, "<blockquote$1><p>");
159
+
text = text.replace(/<\/blockquote><\/p>/g, "</p></blockquote>");
160
+
text = text.replace(
161
+
new RegExp("<p>\\s*(</?" + allBlocks + "[^>]*>)", "g"),
162
+
"$1"
163
+
);
164
+
text = text.replace(
165
+
new RegExp("(</?" + allBlocks + "[^>]*>)\\s*</p>", "g"),
166
+
"$1"
167
+
);
168
+
if (br) {
169
+
text = text.replace(
170
+
/<(script|style).*?<\/\\1>/g,
171
+
(match) => match[0].replace(/\n/g, "<WPPreserveNewline />")
172
+
);
173
+
text = text.replace(/<br>|<br\/>/g, "<br />");
174
+
text = text.replace(
175
+
/(<br \/>)?\s*\n/g,
176
+
(a, b) => b ? a : "<br />\n"
177
+
);
178
+
text = text.replace(/<WPPreserveNewline \/>/g, "\n");
179
+
}
180
+
text = text.replace(
181
+
new RegExp("(</?" + allBlocks + "[^>]*>)\\s*<br />", "g"),
182
+
"$1"
183
+
);
184
+
text = text.replace(
185
+
/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,
186
+
"$1"
187
+
);
188
+
text = text.replace(/\n<\/p>$/g, "</p>");
189
+
preTags.forEach((preTag) => {
190
+
const [name, original] = preTag;
191
+
text = text.replace(name, original);
192
+
});
193
+
if (-1 !== text.indexOf("<!-- wpnl -->")) {
194
+
text = text.replace(/\s?<!-- wpnl -->\s?/g, "\n");
195
+
}
196
+
return text;
197
+
}
198
+
function removep(html) {
199
+
const blocklist = "blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure";
200
+
const blocklist1 = blocklist + "|div|p";
201
+
const blocklist2 = blocklist + "|pre";
202
+
const preserve = [];
203
+
let preserveLinebreaks = false;
204
+
let preserveBr = false;
205
+
if (!html) {
206
+
return "";
207
+
}
208
+
if (html.indexOf("<script") !== -1 || html.indexOf("<style") !== -1) {
209
+
html = html.replace(
210
+
/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,
211
+
(match) => {
212
+
preserve.push(match);
213
+
return "<wp-preserve>";
214
+
}
215
+
);
216
+
}
217
+
if (html.indexOf("<pre") !== -1) {
218
+
preserveLinebreaks = true;
219
+
html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, (a) => {
220
+
a = a.replace(/<br ?\/?>(\r\n|\n)?/g, "<wp-line-break>");
221
+
a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, "<wp-line-break>");
222
+
return a.replace(/\r?\n/g, "<wp-line-break>");
223
+
});
224
+
}
225
+
if (html.indexOf("[caption") !== -1) {
226
+
preserveBr = true;
227
+
html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, (a) => {
228
+
return a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>").replace(/[\r\n\t]+/, "");
229
+
});
230
+
}
231
+
html = html.replace(
232
+
new RegExp("\\s*</(" + blocklist1 + ")>\\s*", "g"),
233
+
"</$1>\n"
234
+
);
235
+
html = html.replace(
236
+
new RegExp("\\s*<((?:" + blocklist1 + ")(?: [^>]*)?)>", "g"),
237
+
"\n<$1>"
238
+
);
239
+
html = html.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g, "$1</p#>");
240
+
html = html.replace(/<div( [^>]*)?>\s*<p>/gi, "<div$1>\n\n");
241
+
html = html.replace(/\s*<p>/gi, "");
242
+
html = html.replace(/\s*<\/p>\s*/gi, "\n\n");
243
+
html = html.replace(/\n[\s\u00a0]+\n/g, "\n\n");
244
+
html = html.replace(/(\s*)<br ?\/?>\s*/gi, (_, space) => {
245
+
if (space && space.indexOf("\n") !== -1) {
246
+
return "\n\n";
247
+
}
248
+
return "\n";
249
+
});
250
+
html = html.replace(/\s*<div/g, "\n<div");
251
+
html = html.replace(/<\/div>\s*/g, "</div>\n");
252
+
html = html.replace(
253
+
/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,
254
+
"\n\n[caption$1[/caption]\n\n"
255
+
);
256
+
html = html.replace(/caption\]\n\n+\[caption/g, "caption]\n\n[caption");
257
+
html = html.replace(
258
+
new RegExp("\\s*<((?:" + blocklist2 + ")(?: [^>]*)?)\\s*>", "g"),
259
+
"\n<$1>"
260
+
);
261
+
html = html.replace(
262
+
new RegExp("\\s*</(" + blocklist2 + ")>\\s*", "g"),
263
+
"</$1>\n"
264
+
);
265
+
html = html.replace(/<((li|dt|dd)[^>]*)>/g, " <$1>");
266
+
if (html.indexOf("<option") !== -1) {
267
+
html = html.replace(/\s*<option/g, "\n<option");
268
+
html = html.replace(/\s*<\/select>/g, "\n</select>");
269
+
}
270
+
if (html.indexOf("<hr") !== -1) {
271
+
html = html.replace(/\s*<hr( [^>]*)?>\s*/g, "\n\n<hr$1>\n\n");
272
+
}
273
+
if (html.indexOf("<object") !== -1) {
274
+
html = html.replace(/<object[\s\S]+?<\/object>/g, (a) => {
275
+
return a.replace(/[\r\n]+/g, "");
276
+
});
277
+
}
278
+
html = html.replace(/<\/p#>/g, "</p>\n");
279
+
html = html.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, "\n$1");
280
+
html = html.replace(/^\s+/, "");
281
+
html = html.replace(/[\s\u00a0]+$/, "");
282
+
if (preserveLinebreaks) {
283
+
html = html.replace(/<wp-line-break>/g, "\n");
284
+
}
285
+
if (preserveBr) {
286
+
html = html.replace(/<wp-temp-br([^>]*)>/g, "<br$1>");
287
+
}
288
+
if (preserve.length) {
289
+
html = html.replace(/<wp-preserve>/g, () => {
290
+
return preserve.shift();
291
+
});
292
+
}
293
+
return html;
294
+
}
295
+
296
+
297
+
(window.wp = window.wp || {}).autop = __webpack_exports__;
298
+
/******/ })()
299
+
;