react-i18next 17.0.10 → 17.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/CHANGELOG.md +5 -0
- package/dist/amd/react-i18next.js +308 -154
- package/dist/amd/react-i18next.min.js +1 -1
- package/dist/commonjs/TransWithoutContext.js +5 -42
- package/dist/es/TransWithoutContext.js +5 -42
- package/dist/es/package.json +1 -1
- package/dist/umd/react-i18next.js +308 -154
- package/dist/umd/react-i18next.min.js +1 -1
- package/package.json +2 -2
- package/react-i18next.js +308 -154
- package/react-i18next.min.js +1 -1
- package/src/TransWithoutContext.js +7 -79
package/react-i18next.js
CHANGED
|
@@ -2245,127 +2245,318 @@
|
|
|
2245
2245
|
instance.loadNamespaces;
|
|
2246
2246
|
instance.loadLanguages;
|
|
2247
2247
|
|
|
2248
|
-
|
|
2249
|
-
|
|
2248
|
+
const voidElements = {
|
|
2249
|
+
area: true,
|
|
2250
|
+
base: true,
|
|
2251
|
+
br: true,
|
|
2252
|
+
col: true,
|
|
2253
|
+
embed: true,
|
|
2254
|
+
hr: true,
|
|
2255
|
+
img: true,
|
|
2256
|
+
input: true,
|
|
2257
|
+
link: true,
|
|
2258
|
+
meta: true,
|
|
2259
|
+
param: true,
|
|
2260
|
+
source: true,
|
|
2261
|
+
track: true,
|
|
2262
|
+
wbr: true,
|
|
2263
|
+
'!doctype': true,
|
|
2264
|
+
'!DOCTYPE': true
|
|
2265
|
+
};
|
|
2266
|
+
const attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;
|
|
2267
|
+
function parseTag(tag) {
|
|
2268
|
+
const res = {
|
|
2269
|
+
type: 'tag',
|
|
2270
|
+
name: '',
|
|
2271
|
+
voidElement: false,
|
|
2272
|
+
attrs: {},
|
|
2273
|
+
children: []
|
|
2274
|
+
};
|
|
2275
|
+
const tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/);
|
|
2276
|
+
if (tagMatch) {
|
|
2277
|
+
res.name = tagMatch[1];
|
|
2278
|
+
if (voidElements[tagMatch[1]] || tag.charAt(tag.length - 2) === '/') {
|
|
2279
|
+
res.voidElement = true;
|
|
2280
|
+
}
|
|
2281
|
+
if (res.name.startsWith('!--')) {
|
|
2282
|
+
const endIndex = tag.indexOf('-->');
|
|
2283
|
+
return {
|
|
2284
|
+
type: 'comment',
|
|
2285
|
+
comment: endIndex !== -1 ? tag.slice(4, endIndex) : ''
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
const reg = new RegExp(attrRE);
|
|
2290
|
+
let result = null;
|
|
2291
|
+
for (;;) {
|
|
2292
|
+
result = reg.exec(tag);
|
|
2293
|
+
if (result === null) {
|
|
2294
|
+
break;
|
|
2295
|
+
}
|
|
2296
|
+
if (!result[0].trim()) {
|
|
2297
|
+
continue;
|
|
2298
|
+
}
|
|
2299
|
+
if (result[1]) {
|
|
2300
|
+
const attr = result[1].trim();
|
|
2301
|
+
let arr = [attr, null];
|
|
2302
|
+
const eq = attr.indexOf('=');
|
|
2303
|
+
if (eq > -1) {
|
|
2304
|
+
arr = [attr.slice(0, eq), attr.slice(eq + 1)];
|
|
2305
|
+
}
|
|
2306
|
+
res.attrs[arr[0]] = arr[1];
|
|
2307
|
+
reg.lastIndex--;
|
|
2308
|
+
} else if (result[2]) {
|
|
2309
|
+
res.attrs[result[2]] = result[3].trim().substring(1, result[3].length - 1);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
return res;
|
|
2250
2313
|
}
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2314
|
+
const tagRE = /<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g;
|
|
2315
|
+
const tagNameRE = /<\/?([^\s]+?)[/\s>]/;
|
|
2316
|
+
const whitespaceRE = /^\s*$/;
|
|
2317
|
+
const rawTextRE = /^(script|style)$/i;
|
|
2318
|
+
const sentinel = '\u0000';
|
|
2319
|
+
const empty = Object.create(null);
|
|
2320
|
+
function restoreSentinels(nodes) {
|
|
2321
|
+
nodes.forEach(function (node) {
|
|
2322
|
+
if (node.type === 'text') {
|
|
2323
|
+
node.content = node.content.split(sentinel).join('<');
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
if (node.type === 'comment') {
|
|
2327
|
+
node.comment = node.comment.split(sentinel).join('<');
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
for (const key in node.attrs) {
|
|
2331
|
+
const value = node.attrs[key];
|
|
2332
|
+
if (typeof value === 'string' && value.indexOf(sentinel) > -1) {
|
|
2333
|
+
node.attrs[key] = value.split(sentinel).join('<');
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
if (node.children.length) {
|
|
2337
|
+
restoreSentinels(node.children);
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
2275
2340
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
type: "tag",
|
|
2284
|
-
name: "",
|
|
2285
|
-
voidElement: false,
|
|
2286
|
-
attrs: {},
|
|
2287
|
-
children: []
|
|
2288
|
-
},
|
|
2289
|
-
i = n.match(/<\/?([^\s]+?)[/\s>]/);
|
|
2290
|
-
if (i && (r.name = i[1], (e[i[1]] || "/" === n.charAt(n.length - 2)) && (r.voidElement = true), r.name.startsWith("!--"))) {
|
|
2291
|
-
var s = n.indexOf("--\x3e");
|
|
2292
|
-
return {
|
|
2293
|
-
type: "comment",
|
|
2294
|
-
comment: -1 !== s ? n.slice(4, s) : ""
|
|
2341
|
+
function parse(html, options) {
|
|
2342
|
+
const components = options && options.components || empty;
|
|
2343
|
+
const allowedTags = options && options.allowedTags;
|
|
2344
|
+
let restoreNeeded = false;
|
|
2345
|
+
if (allowedTags) {
|
|
2346
|
+
const isAllowed = typeof allowedTags === 'function' ? allowedTags : function (name) {
|
|
2347
|
+
return allowedTags.indexOf(name) > -1;
|
|
2295
2348
|
};
|
|
2349
|
+
let out = '';
|
|
2350
|
+
let pos = 0;
|
|
2351
|
+
tagRE.lastIndex = 0;
|
|
2352
|
+
let am;
|
|
2353
|
+
while (am = tagRE.exec(html)) {
|
|
2354
|
+
const tag = am[0];
|
|
2355
|
+
out += html.slice(pos, am.index);
|
|
2356
|
+
const nameMatch = tag.match(tagNameRE);
|
|
2357
|
+
if (tag.startsWith('<!--') || nameMatch && isAllowed(nameMatch[1])) {
|
|
2358
|
+
out += tag;
|
|
2359
|
+
pos = am.index + tag.length;
|
|
2360
|
+
} else {
|
|
2361
|
+
restoreNeeded = true;
|
|
2362
|
+
out += sentinel;
|
|
2363
|
+
pos = am.index + 1;
|
|
2364
|
+
tagRE.lastIndex = pos;
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
html = out + html.slice(pos);
|
|
2296
2368
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
return e + t.content;
|
|
2311
|
-
case "tag":
|
|
2312
|
-
return e += "<" + t.name + (t.attrs ? function (e) {
|
|
2313
|
-
var t = [];
|
|
2314
|
-
for (var n in e) t.push(n + '="' + e[n] + '"');
|
|
2315
|
-
return t.length ? " " + t.join(" ") : "";
|
|
2316
|
-
}(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(a, "") + "</" + t.name + ">";
|
|
2317
|
-
case "comment":
|
|
2318
|
-
return e + "\x3c!--" + t.comment + "--\x3e";
|
|
2369
|
+
const result = [];
|
|
2370
|
+
const arr = [];
|
|
2371
|
+
let current;
|
|
2372
|
+
let level = -1;
|
|
2373
|
+
let inComponent = false;
|
|
2374
|
+
let rawUntil = 0;
|
|
2375
|
+
let htmlLower;
|
|
2376
|
+
if (html.indexOf('<') !== 0) {
|
|
2377
|
+
const end = html.indexOf('<');
|
|
2378
|
+
result.push({
|
|
2379
|
+
type: 'text',
|
|
2380
|
+
content: end === -1 ? html : html.substring(0, end)
|
|
2381
|
+
});
|
|
2319
2382
|
}
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2383
|
+
const matches = [];
|
|
2384
|
+
let m;
|
|
2385
|
+
while (m = tagRE.exec(html)) {
|
|
2386
|
+
matches.push(m);
|
|
2387
|
+
}
|
|
2388
|
+
matches.forEach(function (match, i) {
|
|
2389
|
+
const tag = match[0];
|
|
2390
|
+
if (!tag) return;
|
|
2391
|
+
if (tag.startsWith('<!--')) return;
|
|
2392
|
+
let lts = 0;
|
|
2393
|
+
let gts = 0;
|
|
2394
|
+
let secondLt = -1;
|
|
2395
|
+
let quote = null;
|
|
2396
|
+
for (let j = 0; j < tag.length; j++) {
|
|
2397
|
+
const c = tag.charAt(j);
|
|
2398
|
+
if (quote) {
|
|
2399
|
+
if (c === quote) quote = null;
|
|
2400
|
+
} else if (c === '"' || c === "'") {
|
|
2401
|
+
quote = c;
|
|
2402
|
+
} else if (c === '<') {
|
|
2403
|
+
lts++;
|
|
2404
|
+
if (lts === 2) secondLt = j;
|
|
2405
|
+
} else if (c === '>') {
|
|
2406
|
+
gts++;
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
const validSplit = secondLt > -1 && /[a-zA-Z0-9\-!/]/.test(tag.charAt(secondLt + 1));
|
|
2410
|
+
if (lts > gts && validSplit) {
|
|
2411
|
+
const firstPart = tag.substring(0, secondLt);
|
|
2412
|
+
const secondPart = tag.substring(firstPart.length);
|
|
2413
|
+
matches[i][0] = secondPart;
|
|
2414
|
+
matches[i].index += firstPart.length;
|
|
2335
2415
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2416
|
+
});
|
|
2417
|
+
matches.forEach(function (match, i) {
|
|
2418
|
+
const tag = match[0];
|
|
2419
|
+
if (!tag) return;
|
|
2420
|
+
const index = match.index;
|
|
2421
|
+
if (index < rawUntil) return;
|
|
2422
|
+
if (inComponent) {
|
|
2423
|
+
if (tag !== '</' + current.name + '>') {
|
|
2424
|
+
return;
|
|
2425
|
+
} else {
|
|
2426
|
+
inComponent = false;
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
const isOpen = tag.charAt(1) !== '/';
|
|
2430
|
+
const isComment = tag.startsWith('<!--');
|
|
2431
|
+
const start = index + tag.length;
|
|
2432
|
+
const nextChar = html.charAt(start);
|
|
2433
|
+
const nextMatch = matches[i + 1];
|
|
2434
|
+
let isText;
|
|
2435
|
+
if (nextChar === '<' && nextMatch) {
|
|
2436
|
+
const nextTag = html.substring(start, nextMatch.index);
|
|
2437
|
+
isText = nextTag.split('<').length > nextTag.split('>').length;
|
|
2438
|
+
}
|
|
2439
|
+
let parent;
|
|
2440
|
+
if (isComment) {
|
|
2441
|
+
const comment = parseTag(tag);
|
|
2442
|
+
if (level < 0) {
|
|
2443
|
+
result.push(comment);
|
|
2444
|
+
return result;
|
|
2445
|
+
}
|
|
2446
|
+
parent = arr[level];
|
|
2447
|
+
parent.children.push(comment);
|
|
2448
|
+
const text = html.slice(start, nextMatch ? nextMatch.index : undefined);
|
|
2449
|
+
if (text.length > 0) {
|
|
2450
|
+
parent.children.push({
|
|
2451
|
+
type: 'text',
|
|
2452
|
+
content: text
|
|
2360
2453
|
});
|
|
2361
2454
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2455
|
+
return result;
|
|
2456
|
+
}
|
|
2457
|
+
if (isOpen) {
|
|
2458
|
+
level++;
|
|
2459
|
+
current = parseTag(tag);
|
|
2460
|
+
if (current.type === 'tag' && components[current.name]) {
|
|
2461
|
+
current.type = 'component';
|
|
2462
|
+
inComponent = true;
|
|
2463
|
+
}
|
|
2464
|
+
let isRawText = false;
|
|
2465
|
+
if (!inComponent && !current.voidElement && rawTextRE.test(current.name)) {
|
|
2466
|
+
isRawText = true;
|
|
2467
|
+
htmlLower || (htmlLower = html.toLowerCase());
|
|
2468
|
+
const closeIndex = htmlLower.indexOf('</' + current.name.toLowerCase() + '>', start);
|
|
2469
|
+
const contentEnd = closeIndex === -1 ? html.length : closeIndex;
|
|
2470
|
+
const content = html.slice(start, contentEnd);
|
|
2471
|
+
if (content) {
|
|
2472
|
+
current.children.push({
|
|
2473
|
+
type: 'text',
|
|
2474
|
+
content
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
rawUntil = contentEnd;
|
|
2478
|
+
}
|
|
2479
|
+
if (!current.voidElement && !inComponent && !isRawText && nextChar && nextChar !== '<') {
|
|
2480
|
+
current.children.push({
|
|
2481
|
+
type: 'text',
|
|
2482
|
+
content: html.slice(start, nextMatch ? nextMatch.index : undefined)
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
if (level === 0) {
|
|
2486
|
+
result.push(current);
|
|
2487
|
+
}
|
|
2488
|
+
parent = arr[level - 1];
|
|
2489
|
+
if (parent) {
|
|
2490
|
+
parent.children.push(current);
|
|
2491
|
+
}
|
|
2492
|
+
arr[level] = current;
|
|
2493
|
+
}
|
|
2494
|
+
if (!isOpen || current.voidElement) {
|
|
2495
|
+
if (level > -1 && (current.voidElement || current.name === tag.slice(2, -1))) {
|
|
2496
|
+
level--;
|
|
2497
|
+
current = level === -1 ? result : arr[level];
|
|
2498
|
+
}
|
|
2499
|
+
if (!inComponent && (nextChar !== '<' || isText) && nextChar) {
|
|
2500
|
+
parent = level === -1 ? result : arr[level].children;
|
|
2501
|
+
const end = nextMatch ? nextMatch.index : -1;
|
|
2502
|
+
let content = html.slice(start, end === -1 ? undefined : end);
|
|
2503
|
+
if (whitespaceRE.test(content)) {
|
|
2504
|
+
content = ' ';
|
|
2505
|
+
}
|
|
2506
|
+
if (end > -1 && level + parent.length >= 0 || content !== ' ') {
|
|
2507
|
+
parent.push({
|
|
2508
|
+
type: 'text',
|
|
2509
|
+
content
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
});
|
|
2515
|
+
if (restoreNeeded) {
|
|
2516
|
+
restoreSentinels(result);
|
|
2517
|
+
}
|
|
2518
|
+
return result;
|
|
2519
|
+
}
|
|
2520
|
+
function attrString(attrs) {
|
|
2521
|
+
const buff = [];
|
|
2522
|
+
for (const key in attrs) {
|
|
2523
|
+
if (attrs[key] === null) {
|
|
2524
|
+
buff.push(key);
|
|
2525
|
+
} else {
|
|
2526
|
+
buff.push(key + '="' + String(attrs[key]).replace(/"/g, '"') + '"');
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
if (!buff.length) {
|
|
2530
|
+
return '';
|
|
2368
2531
|
}
|
|
2532
|
+
return ' ' + buff.join(' ');
|
|
2533
|
+
}
|
|
2534
|
+
function stringifyNode(buff, doc) {
|
|
2535
|
+
switch (doc.type) {
|
|
2536
|
+
case 'text':
|
|
2537
|
+
return buff + doc.content;
|
|
2538
|
+
case 'tag':
|
|
2539
|
+
{
|
|
2540
|
+
const tagEnd = doc.voidElement && doc.name.toLowerCase() !== '!doctype' ? '/>' : '>';
|
|
2541
|
+
buff += '<' + doc.name + (doc.attrs ? attrString(doc.attrs) : '') + tagEnd;
|
|
2542
|
+
if (doc.voidElement) {
|
|
2543
|
+
return buff;
|
|
2544
|
+
}
|
|
2545
|
+
return buff + doc.children.reduce(stringifyNode, '') + '</' + doc.name + '>';
|
|
2546
|
+
}
|
|
2547
|
+
case 'comment':
|
|
2548
|
+
buff += '<!--' + doc.comment + '-->';
|
|
2549
|
+
return buff;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
function stringify(doc) {
|
|
2553
|
+
return doc.reduce(function (token, rootEl) {
|
|
2554
|
+
return token + stringifyNode('', rootEl);
|
|
2555
|
+
}, '');
|
|
2556
|
+
}
|
|
2557
|
+
var index = {
|
|
2558
|
+
parse,
|
|
2559
|
+
stringify
|
|
2369
2560
|
};
|
|
2370
2561
|
|
|
2371
2562
|
const warn = (i18n, code, msg, rest) => {
|
|
@@ -2583,46 +2774,6 @@
|
|
|
2583
2774
|
});
|
|
2584
2775
|
return stringNode;
|
|
2585
2776
|
};
|
|
2586
|
-
const escapeLiteralLessThan = (str, keepArray = [], knownComponentsMap = {}) => {
|
|
2587
|
-
if (!str) return str;
|
|
2588
|
-
const knownNames = Object.keys(knownComponentsMap);
|
|
2589
|
-
const allValidNames = [...keepArray, ...knownNames];
|
|
2590
|
-
let result = '';
|
|
2591
|
-
let i = 0;
|
|
2592
|
-
while (i < str.length) {
|
|
2593
|
-
if (str[i] === '<') {
|
|
2594
|
-
let isValidTag = false;
|
|
2595
|
-
const closingMatch = str.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);
|
|
2596
|
-
if (closingMatch) {
|
|
2597
|
-
const tagName = closingMatch[1];
|
|
2598
|
-
if (/^\d+$/.test(tagName) || allValidNames.includes(tagName)) {
|
|
2599
|
-
isValidTag = true;
|
|
2600
|
-
result += closingMatch[0];
|
|
2601
|
-
i += closingMatch[0].length;
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
if (!isValidTag) {
|
|
2605
|
-
const openingMatch = str.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);
|
|
2606
|
-
if (openingMatch) {
|
|
2607
|
-
const tagName = openingMatch[1];
|
|
2608
|
-
if (/^\d+$/.test(tagName) || allValidNames.includes(tagName)) {
|
|
2609
|
-
isValidTag = true;
|
|
2610
|
-
result += openingMatch[0];
|
|
2611
|
-
i += openingMatch[0].length;
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
if (!isValidTag) {
|
|
2616
|
-
result += '<';
|
|
2617
|
-
i += 1;
|
|
2618
|
-
}
|
|
2619
|
-
} else {
|
|
2620
|
-
result += str[i];
|
|
2621
|
-
i += 1;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
return result;
|
|
2625
|
-
};
|
|
2626
2777
|
const renderNodes = (children, knownComponentsMap, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => {
|
|
2627
2778
|
if (targetString === '') return [];
|
|
2628
2779
|
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
@@ -2637,8 +2788,11 @@
|
|
|
2637
2788
|
});
|
|
2638
2789
|
};
|
|
2639
2790
|
getData(children);
|
|
2640
|
-
const
|
|
2641
|
-
const
|
|
2791
|
+
const knownNames = Object.keys(data);
|
|
2792
|
+
const allowedTags = name => /^\d+$/.test(name) || keepArray.indexOf(name) > -1 || knownNames.indexOf(name) > -1;
|
|
2793
|
+
const ast = index.parse(`<0>${targetString}</0>`, {
|
|
2794
|
+
allowedTags
|
|
2795
|
+
});
|
|
2642
2796
|
const opts = {
|
|
2643
2797
|
...data,
|
|
2644
2798
|
...combinedTOpts
|