80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 283); |
85 /******/ return __webpack_require__(__webpack_require__.s = "zbAn"); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 14: |
90 /***/ "zbAn": |
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 |
|
95 // EXPORTS |
|
96 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
97 |
|
98 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
99 var arrayWithHoles = __webpack_require__(38); |
|
100 |
|
101 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
102 function _iterableToArrayLimit(arr, i) { |
|
103 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
104 var _arr = []; |
|
105 var _n = true; |
|
106 var _d = false; |
|
107 var _e = undefined; |
|
108 |
|
109 try { |
|
110 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
111 _arr.push(_s.value); |
|
112 |
|
113 if (i && _arr.length === i) break; |
|
114 } |
|
115 } catch (err) { |
|
116 _d = true; |
|
117 _e = err; |
|
118 } finally { |
|
119 try { |
|
120 if (!_n && _i["return"] != null) _i["return"](); |
|
121 } finally { |
|
122 if (_d) throw _e; |
|
123 } |
|
124 } |
|
125 |
|
126 return _arr; |
|
127 } |
|
128 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
129 var unsupportedIterableToArray = __webpack_require__(29); |
|
130 |
|
131 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
132 var nonIterableRest = __webpack_require__(39); |
|
133 |
|
134 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 function _slicedToArray(arr, i) { |
|
140 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
141 } |
|
142 |
|
143 /***/ }), |
|
144 |
|
145 /***/ 26: |
|
146 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
147 |
|
148 "use strict"; |
|
149 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
150 function _arrayLikeToArray(arr, len) { |
|
151 if (len == null || len > arr.length) len = arr.length; |
|
152 |
|
153 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
154 arr2[i] = arr[i]; |
|
155 } |
|
156 |
|
157 return arr2; |
|
158 } |
|
159 |
|
160 /***/ }), |
|
161 |
|
162 /***/ 283: |
|
163 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
164 |
92 |
165 "use strict"; |
93 "use strict"; |
166 __webpack_require__.r(__webpack_exports__); |
94 __webpack_require__.r(__webpack_exports__); |
167 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autop", function() { return autop; }); |
95 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autop", function() { return autop; }); |
168 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removep", function() { return removep; }); |
96 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removep", function() { return removep; }); |
169 /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); |
|
170 |
|
171 |
|
172 /** |
97 /** |
173 * The regular expression for an HTML element. |
98 * The regular expression for an HTML element. |
174 * |
99 * |
175 * @type {RegExp} |
100 * @type {RegExp} |
176 */ |
101 */ |
177 var htmlSplitRegex = function () { |
102 const htmlSplitRegex = (() => { |
178 /* eslint-disable no-multi-spaces */ |
103 /* eslint-disable no-multi-spaces */ |
179 var comments = '!' + // Start of comment, after the <. |
104 const comments = '!' + // Start of comment, after the <. |
180 '(?:' + // Unroll the loop: Consume everything until --> is found. |
105 '(?:' + // Unroll the loop: Consume everything until --> is found. |
181 '-(?!->)' + // Dash not followed by end of comment. |
106 '-(?!->)' + // Dash not followed by end of comment. |
182 '[^\\-]*' + // Consume non-dashes. |
107 '[^\\-]*' + // Consume non-dashes. |
183 ')*' + // Loop possessively. |
108 ')*' + // Loop possessively. |
184 '(?:-->)?'; // End of comment. If not found, match all input. |
109 '(?:-->)?'; // End of comment. If not found, match all input. |
185 |
110 |
186 var cdata = '!\\[CDATA\\[' + // Start of comment, after the <. |
111 const cdata = '!\\[CDATA\\[' + // Start of comment, after the <. |
187 '[^\\]]*' + // Consume non-]. |
112 '[^\\]]*' + // Consume non-]. |
188 '(?:' + // Unroll the loop: Consume everything until ]]> is found. |
113 '(?:' + // Unroll the loop: Consume everything until ]]> is found. |
189 '](?!]>)' + // One ] not followed by end of comment. |
114 '](?!]>)' + // One ] not followed by end of comment. |
190 '[^\\]]*' + // Consume non-]. |
115 '[^\\]]*' + // Consume non-]. |
191 ')*?' + // Loop possessively. |
116 ')*?' + // Loop possessively. |
192 '(?:]]>)?'; // End of comment. If not found, match all input. |
117 '(?:]]>)?'; // End of comment. If not found, match all input. |
193 |
118 |
194 var escaped = '(?=' + // Is the element escaped? |
119 const escaped = '(?=' + // Is the element escaped? |
195 '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type? |
120 '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type? |
196 comments + '|' + cdata + ')'; |
121 comments + '|' + cdata + ')'; |
197 var regex = '(' + // Capture the entire match. |
122 const regex = '(' + // Capture the entire match. |
198 '<' + // Find start of element. |
123 '<' + // Find start of element. |
199 '(' + // Conditional expression follows. |
124 '(' + // Conditional expression follows. |
200 escaped + // Find end of escaped element. |
125 escaped + // Find end of escaped element. |
201 '|' + // ... else ... |
126 '|' + // ... else ... |
202 '[^>]*>?' + // Find end of normal element. |
127 '[^>]*>?' + // Find end of normal element. |
203 ')' + ')'; |
128 ')' + ')'; |
204 return new RegExp(regex); |
129 return new RegExp(regex); |
205 /* eslint-enable no-multi-spaces */ |
130 /* eslint-enable no-multi-spaces */ |
206 }(); |
131 })(); |
207 /** |
132 /** |
208 * Separate HTML elements and comments from the text. |
133 * Separate HTML elements and comments from the text. |
209 * |
134 * |
210 * @param {string} input The text which has to be formatted. |
135 * @param {string} input The text which has to be formatted. |
211 * @return {string[]} The formatted text. |
136 * @return {string[]} The formatted text. |
212 */ |
137 */ |
213 |
138 |
214 |
139 |
215 function htmlSplit(input) { |
140 function htmlSplit(input) { |
216 var parts = []; |
141 const parts = []; |
217 var workingInput = input; |
142 let workingInput = input; |
218 var match; |
143 let match; |
219 |
144 |
220 while (match = workingInput.match(htmlSplitRegex)) { |
145 while (match = workingInput.match(htmlSplitRegex)) { |
221 // The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`. |
146 // The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`. |
222 // If the `g` flag is omitted, `index` is included. |
147 // If the `g` flag is omitted, `index` is included. |
223 // `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number. |
148 // `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number. |
224 // Assert `match.index` is a number. |
149 // Assert `match.index` is a number. |
225 var index = |
150 const index = |
226 /** @type {number} */ |
151 /** @type {number} */ |
227 match.index; |
152 match.index; |
228 parts.push(workingInput.slice(0, index)); |
153 parts.push(workingInput.slice(0, index)); |
229 parts.push(match[0]); |
154 parts.push(match[0]); |
230 workingInput = workingInput.slice(index + match[0].length); |
155 workingInput = workingInput.slice(index + match[0].length); |
306 * Pre tags shouldn't be touched by autop. |
230 * Pre tags shouldn't be touched by autop. |
307 * Replace pre tags with placeholders and bring them back after autop. |
231 * Replace pre tags with placeholders and bring them back after autop. |
308 */ |
232 */ |
309 |
233 |
310 if (text.indexOf('<pre') !== -1) { |
234 if (text.indexOf('<pre') !== -1) { |
311 var textParts = text.split('</pre>'); |
235 const textParts = text.split('</pre>'); |
312 var lastText = textParts.pop(); |
236 const lastText = textParts.pop(); |
313 text = ''; |
237 text = ''; |
314 |
238 |
315 for (var i = 0; i < textParts.length; i++) { |
239 for (let i = 0; i < textParts.length; i++) { |
316 var textPart = textParts[i]; |
240 const textPart = textParts[i]; |
317 var start = textPart.indexOf('<pre'); // Malformed html? |
241 const start = textPart.indexOf('<pre'); // Malformed html? |
318 |
242 |
319 if (start === -1) { |
243 if (start === -1) { |
320 text += textPart; |
244 text += textPart; |
321 continue; |
245 continue; |
322 } |
246 } |
323 |
247 |
324 var name = '<pre wp-pre-tag-' + i + '></pre>'; |
248 const name = '<pre wp-pre-tag-' + i + '></pre>'; |
325 preTags.push([name, textPart.substr(start) + '</pre>']); |
249 preTags.push([name, textPart.substr(start) + '</pre>']); |
326 text += textPart.substr(0, start) + name; |
250 text += textPart.substr(0, start) + name; |
327 } |
251 } |
328 |
252 |
329 text += lastText; |
253 text += lastText; |
330 } // Change multiple <br>s into two line breaks, which will turn into paragraphs. |
254 } // Change multiple <br>s into two line breaks, which will turn into paragraphs. |
331 |
255 |
332 |
256 |
333 text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n'); |
257 text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n'); |
334 var 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)'; // Add a double line break above block-level opening tags. |
258 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)'; // Add a double line break above block-level opening tags. |
335 |
259 |
336 text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. |
260 text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. |
337 |
261 |
338 text = text.replace(new RegExp('(</' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". |
262 text = text.replace(new RegExp('(</' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". |
339 |
263 |
402 |
326 |
403 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // Optionally insert line breaks. |
327 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // Optionally insert line breaks. |
404 |
328 |
405 if (br) { |
329 if (br) { |
406 // Replace newlines that shouldn't be touched with a placeholder. |
330 // Replace newlines that shouldn't be touched with a placeholder. |
407 text = text.replace(/<(script|style).*?<\/\\1>/g, function (match) { |
331 text = text.replace(/<(script|style).*?<\/\\1>/g, match => match[0].replace(/\n/g, '<WPPreserveNewline />')); // Normalize <br> |
408 return match[0].replace(/\n/g, '<WPPreserveNewline />'); |
|
409 }); // Normalize <br> |
|
410 |
332 |
411 text = text.replace(/<br>|<br\/>/g, '<br />'); // Replace any new line characters that aren't preceded by a <br /> with a <br />. |
333 text = text.replace(/<br>|<br\/>/g, '<br />'); // Replace any new line characters that aren't preceded by a <br /> with a <br />. |
412 |
334 |
413 text = text.replace(/(<br \/>)?\s*\n/g, function (a, b) { |
335 text = text.replace(/(<br \/>)?\s*\n/g, (a, b) => b ? a : '<br />\n'); // Replace newline placeholders with newlines. |
414 return b ? a : '<br />\n'; |
|
415 }); // Replace newline placeholders with newlines. |
|
416 |
336 |
417 text = text.replace(/<WPPreserveNewline \/>/g, '\n'); |
337 text = text.replace(/<WPPreserveNewline \/>/g, '\n'); |
418 } // If a <br /> tag is after an opening or closing block tag, remove it. |
338 } // If a <br /> tag is after an opening or closing block tag, remove it. |
419 |
339 |
420 |
340 |
421 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*<br />', 'g'), '$1'); // If a <br /> tag is before a subset of opening or closing block tags, remove it. |
341 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*<br />', 'g'), '$1'); // If a <br /> tag is before a subset of opening or closing block tags, remove it. |
422 |
342 |
423 text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); |
343 text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); |
424 text = text.replace(/\n<\/p>$/g, '</p>'); // Replace placeholder <pre> tags with their original content. |
344 text = text.replace(/\n<\/p>$/g, '</p>'); // Replace placeholder <pre> tags with their original content. |
425 |
345 |
426 preTags.forEach(function (preTag) { |
346 preTags.forEach(preTag => { |
427 var _preTag = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(preTag, 2), |
347 const [name, original] = preTag; |
428 name = _preTag[0], |
|
429 original = _preTag[1]; |
|
430 |
|
431 text = text.replace(name, original); |
348 text = text.replace(name, original); |
432 }); // Restore newlines in all elements. |
349 }); // Restore newlines in all elements. |
433 |
350 |
434 if (-1 !== text.indexOf('<!-- wpnl -->')) { |
351 if (-1 !== text.indexOf('<!-- wpnl -->')) { |
435 text = text.replace(/\s?<!-- wpnl -->\s?/g, '\n'); |
352 text = text.replace(/\s?<!-- wpnl -->\s?/g, '\n'); |
453 * |
370 * |
454 * @return {string} The content with stripped paragraph tags. |
371 * @return {string} The content with stripped paragraph tags. |
455 */ |
372 */ |
456 |
373 |
457 function removep(html) { |
374 function removep(html) { |
458 var blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure'; |
375 const blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure'; |
459 var blocklist1 = blocklist + '|div|p'; |
376 const blocklist1 = blocklist + '|div|p'; |
460 var blocklist2 = blocklist + '|pre'; |
377 const blocklist2 = blocklist + '|pre'; |
461 /** @type {string[]} */ |
378 /** @type {string[]} */ |
462 |
379 |
463 var preserve = []; |
380 const preserve = []; |
464 var preserveLinebreaks = false; |
381 let preserveLinebreaks = false; |
465 var preserveBr = false; |
382 let preserveBr = false; |
466 |
383 |
467 if (!html) { |
384 if (!html) { |
468 return ''; |
385 return ''; |
469 } // Protect script and style tags. |
386 } // Protect script and style tags. |
470 |
387 |
471 |
388 |
472 if (html.indexOf('<script') !== -1 || html.indexOf('<style') !== -1) { |
389 if (html.indexOf('<script') !== -1 || html.indexOf('<style') !== -1) { |
473 html = html.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, function (match) { |
390 html = html.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, match => { |
474 preserve.push(match); |
391 preserve.push(match); |
475 return '<wp-preserve>'; |
392 return '<wp-preserve>'; |
476 }); |
393 }); |
477 } // Protect pre tags. |
394 } // Protect pre tags. |
478 |
395 |
479 |
396 |
480 if (html.indexOf('<pre') !== -1) { |
397 if (html.indexOf('<pre') !== -1) { |
481 preserveLinebreaks = true; |
398 preserveLinebreaks = true; |
482 html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, function (a) { |
399 html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, a => { |
483 a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>'); |
400 a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>'); |
484 a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>'); |
401 a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>'); |
485 return a.replace(/\r?\n/g, '<wp-line-break>'); |
402 return a.replace(/\r?\n/g, '<wp-line-break>'); |
486 }); |
403 }); |
487 } // Remove line breaks but keep <br> tags inside image captions. |
404 } // Remove line breaks but keep <br> tags inside image captions. |
488 |
405 |
489 |
406 |
490 if (html.indexOf('[caption') !== -1) { |
407 if (html.indexOf('[caption') !== -1) { |
491 preserveBr = true; |
408 preserveBr = true; |
492 html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, function (a) { |
409 html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, a => { |
493 return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, ''); |
410 return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, ''); |
494 }); |
411 }); |
495 } // Normalize white space characters before and after block tags. |
412 } // Normalize white space characters before and after block tags. |
496 |
413 |
497 |
414 |