wikiparser-node 1.13.1-b → 1.13.1
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/config/.schema.json +203 -0
- package/config/default.json +32 -31
- package/config/enwiki.json +829 -15
- package/config/llwiki.json +56 -21
- package/config/moegirl.json +65 -21
- package/config/zhwiki.json +498 -32
- package/dist/addon/table.js +494 -0
- package/dist/addon/token.js +392 -0
- package/dist/addon/transclude.js +184 -0
- package/dist/base.d.ts +110 -0
- package/dist/base.js +67 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +279 -0
- package/dist/internal.d.ts +47 -0
- package/dist/lib/element.d.ts +125 -0
- package/dist/lib/element.js +364 -0
- package/dist/lib/node.d.ts +173 -0
- package/dist/lib/node.js +478 -0
- package/dist/lib/range.d.ts +105 -0
- package/dist/lib/range.js +406 -0
- package/dist/lib/ranges.d.ts +28 -0
- package/dist/lib/ranges.js +126 -0
- package/dist/lib/rect.d.ts +18 -0
- package/dist/lib/rect.js +36 -0
- package/dist/lib/text.d.ts +58 -0
- package/dist/lib/text.js +414 -0
- package/dist/lib/title.d.ts +49 -0
- package/dist/lib/title.js +251 -0
- package/dist/mixin/attributesParent.d.ts +49 -0
- package/dist/mixin/attributesParent.js +80 -0
- package/dist/mixin/fixed.d.ts +5 -0
- package/dist/mixin/fixed.js +32 -0
- package/dist/mixin/flagsParent.d.ts +43 -0
- package/dist/mixin/flagsParent.js +64 -0
- package/dist/mixin/hidden.d.ts +7 -0
- package/dist/mixin/hidden.js +39 -0
- package/dist/mixin/magicLinkParent.d.ts +19 -0
- package/dist/mixin/magicLinkParent.js +43 -0
- package/dist/mixin/singleLine.d.ts +5 -0
- package/dist/mixin/singleLine.js +25 -0
- package/dist/mixin/sol.d.ts +6 -0
- package/dist/mixin/sol.js +45 -0
- package/dist/mixin/syntax.d.ts +8 -0
- package/dist/mixin/syntax.js +46 -0
- package/dist/parser/braces.js +152 -0
- package/dist/parser/commentAndExt.js +84 -0
- package/dist/parser/converter.js +41 -0
- package/dist/parser/externalLinks.js +39 -0
- package/dist/parser/hrAndDoubleUnderscore.js +44 -0
- package/dist/parser/html.js +40 -0
- package/dist/parser/links.js +103 -0
- package/dist/parser/list.js +116 -0
- package/dist/parser/magicLinks.js +55 -0
- package/dist/parser/quotes.js +69 -0
- package/dist/parser/redirect.js +28 -0
- package/dist/parser/selector.js +443 -0
- package/dist/parser/table.js +125 -0
- package/dist/src/arg.d.ts +49 -0
- package/dist/src/arg.js +220 -0
- package/dist/src/atom.d.ts +14 -0
- package/dist/src/atom.js +54 -0
- package/dist/src/attribute.d.ts +64 -0
- package/dist/src/attribute.js +482 -0
- package/dist/src/attributes.d.ts +103 -0
- package/dist/src/attributes.js +383 -0
- package/dist/src/converter.d.ts +28 -0
- package/dist/src/converter.js +153 -0
- package/dist/src/converterFlags.d.ts +80 -0
- package/dist/src/converterFlags.js +241 -0
- package/dist/src/converterRule.d.ts +71 -0
- package/dist/src/converterRule.js +218 -0
- package/dist/src/extLink.d.ts +36 -0
- package/dist/src/extLink.js +223 -0
- package/dist/src/gallery.d.ts +51 -0
- package/dist/src/gallery.js +166 -0
- package/dist/src/heading.d.ts +44 -0
- package/dist/src/heading.js +222 -0
- package/dist/src/hidden.d.ts +9 -0
- package/dist/src/hidden.js +82 -0
- package/dist/src/html.d.ts +61 -0
- package/dist/src/html.js +344 -0
- package/dist/src/imageParameter.d.ts +60 -0
- package/dist/src/imageParameter.js +262 -0
- package/dist/src/imagemap.d.ts +47 -0
- package/dist/src/imagemap.js +148 -0
- package/dist/src/imagemapLink.d.ts +35 -0
- package/dist/src/imagemapLink.js +99 -0
- package/dist/src/index.d.ts +136 -0
- package/dist/src/index.js +790 -0
- package/dist/src/link/base.d.ts +52 -0
- package/dist/src/link/base.js +258 -0
- package/dist/src/link/category.d.ts +22 -0
- package/dist/src/link/category.js +36 -0
- package/dist/src/link/file.d.ts +102 -0
- package/dist/src/link/file.js +345 -0
- package/dist/src/link/galleryImage.d.ts +29 -0
- package/dist/src/link/galleryImage.js +133 -0
- package/dist/src/link/index.d.ts +39 -0
- package/dist/src/link/index.js +100 -0
- package/dist/src/link/redirectTarget.d.ts +27 -0
- package/dist/src/link/redirectTarget.js +71 -0
- package/dist/src/magicLink.d.ts +57 -0
- package/dist/src/magicLink.js +261 -0
- package/dist/src/nested.d.ts +40 -0
- package/dist/src/nested.js +108 -0
- package/dist/src/nowiki/base.d.ts +28 -0
- package/dist/src/nowiki/base.js +90 -0
- package/dist/src/nowiki/comment.d.ts +14 -0
- package/dist/src/nowiki/comment.js +123 -0
- package/dist/src/nowiki/dd.d.ts +8 -0
- package/dist/src/nowiki/dd.js +74 -0
- package/dist/src/nowiki/doubleUnderscore.d.ts +15 -0
- package/dist/src/nowiki/doubleUnderscore.js +101 -0
- package/dist/src/nowiki/hr.d.ts +5 -0
- package/dist/src/nowiki/hr.js +72 -0
- package/dist/src/nowiki/index.d.ts +14 -0
- package/dist/src/nowiki/index.js +30 -0
- package/dist/src/nowiki/list.d.ts +5 -0
- package/dist/src/nowiki/list.js +67 -0
- package/dist/src/nowiki/listBase.d.ts +23 -0
- package/dist/src/nowiki/listBase.js +100 -0
- package/dist/src/nowiki/noinclude.d.ts +6 -0
- package/dist/src/nowiki/noinclude.js +77 -0
- package/dist/src/nowiki/quote.d.ts +14 -0
- package/dist/src/nowiki/quote.js +149 -0
- package/dist/src/onlyinclude.d.ts +13 -0
- package/dist/src/onlyinclude.js +60 -0
- package/dist/src/paramTag/index.d.ts +28 -0
- package/dist/src/paramTag/index.js +80 -0
- package/dist/src/paramTag/inputbox.d.ts +8 -0
- package/dist/src/paramTag/inputbox.js +38 -0
- package/dist/src/parameter.d.ts +60 -0
- package/dist/src/parameter.js +267 -0
- package/dist/src/pre.d.ts +28 -0
- package/dist/src/pre.js +70 -0
- package/dist/src/redirect.d.ts +30 -0
- package/dist/src/redirect.js +128 -0
- package/dist/src/syntax.d.ts +15 -0
- package/dist/src/syntax.js +87 -0
- package/dist/src/table/base.d.ts +28 -0
- package/dist/src/table/base.js +81 -0
- package/dist/src/table/index.d.ts +230 -0
- package/dist/src/table/index.js +506 -0
- package/dist/src/table/td.d.ts +72 -0
- package/dist/src/table/td.js +375 -0
- package/dist/src/table/tr.d.ts +30 -0
- package/dist/src/table/tr.js +61 -0
- package/dist/src/table/trBase.d.ts +49 -0
- package/dist/src/table/trBase.js +165 -0
- package/dist/src/tagPair/ext.d.ts +29 -0
- package/dist/src/tagPair/ext.js +229 -0
- package/dist/src/tagPair/include.d.ts +33 -0
- package/dist/src/tagPair/include.js +145 -0
- package/dist/src/tagPair/index.d.ts +23 -0
- package/dist/src/tagPair/index.js +130 -0
- package/dist/src/transclude.d.ts +159 -0
- package/dist/src/transclude.js +598 -0
- package/dist/util/constants.js +26 -0
- package/dist/util/debug.js +95 -0
- package/dist/util/diff.js +83 -0
- package/dist/util/html.js +146 -0
- package/dist/util/lint.js +32 -0
- package/dist/util/string.js +107 -0
- package/errors/README +3 -0
- package/package.json +21 -28
- package/printed/README +3 -0
- package/bundle/bundle.min.js +0 -37
- package/extensions/dist/base.js +0 -163
- package/extensions/dist/codejar.js +0 -53
- package/extensions/dist/editor.js +0 -159
- package/extensions/dist/highlight.js +0 -30
- package/extensions/dist/lint.js +0 -72
- package/extensions/editor.css +0 -59
- package/extensions/ui.css +0 -162
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseList = void 0;
|
|
4
|
+
const html_1 = require("../util/html");
|
|
5
|
+
const list_1 = require("../src/nowiki/list");
|
|
6
|
+
const dd_1 = require("../src/nowiki/dd");
|
|
7
|
+
/* NOT FOR BROWSER */
|
|
8
|
+
const constants_1 = require("../util/constants");
|
|
9
|
+
/* NOT FOR BROWSER END */
|
|
10
|
+
/**
|
|
11
|
+
* 解析列表
|
|
12
|
+
* @param wikitext
|
|
13
|
+
* @param state
|
|
14
|
+
* @param state.lastPrefix 上一个列表的前缀
|
|
15
|
+
* @param config
|
|
16
|
+
* @param accum
|
|
17
|
+
*/
|
|
18
|
+
const parseList = (wikitext, state, config, accum) => {
|
|
19
|
+
const mt = /^((?:\0\d+[cno]\x7F)*)([;:*#]+\s*)/u.exec(wikitext);
|
|
20
|
+
if (!mt) {
|
|
21
|
+
state.lastPrefix = '';
|
|
22
|
+
return wikitext;
|
|
23
|
+
}
|
|
24
|
+
const [total, comment, prefix] = mt, prefix2 = prefix.replace(/;/gu, ':'), commonPrefixLength = (0, html_1.getCommon)(prefix2, state.lastPrefix), parts = (commonPrefixLength > 1 ? prefix.slice(commonPrefixLength - 1) : prefix).split(/(?=;)/u), isDt = parts[0].startsWith(';');
|
|
25
|
+
let dt = parts.length - (isDt ? 0 : 1);
|
|
26
|
+
if (commonPrefixLength > 1) {
|
|
27
|
+
const commonPrefix = prefix.slice(0, commonPrefixLength - 1);
|
|
28
|
+
if (isDt) {
|
|
29
|
+
parts.unshift(commonPrefix);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
parts[0] = commonPrefix + parts[0];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
state.lastPrefix = prefix2;
|
|
36
|
+
let text = comment + parts.map((_, i) => `\0${accum.length + i}d\x7F`).join('') + wikitext.slice(total.length);
|
|
37
|
+
for (const part of parts) {
|
|
38
|
+
// @ts-expect-error abstract class
|
|
39
|
+
new list_1.ListToken(part, config, accum);
|
|
40
|
+
}
|
|
41
|
+
if (!dt) {
|
|
42
|
+
return text;
|
|
43
|
+
}
|
|
44
|
+
const { html: [normalTags] } = config, fullRegex = /:+|-\{|\0\d+[xq]\x7F/gu;
|
|
45
|
+
let regex = fullRegex, ex = regex.exec(text), lt = 0, lb = false, li = false, lc = 0;
|
|
46
|
+
/**
|
|
47
|
+
* 创建`DdToken`
|
|
48
|
+
* @param syntax `:`
|
|
49
|
+
* @param index 起点
|
|
50
|
+
*/
|
|
51
|
+
const dd = (syntax, index) => {
|
|
52
|
+
// @ts-expect-error abstract class
|
|
53
|
+
new dd_1.DdToken(syntax, config, accum);
|
|
54
|
+
return `${text.slice(0, index)}\0${accum.length - 1}d\x7F${text.slice(index + syntax.length)}`;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* 更新 `lt`
|
|
58
|
+
* @param closing 是否是闭合标签
|
|
59
|
+
*/
|
|
60
|
+
const update = (closing) => {
|
|
61
|
+
if (!closing) {
|
|
62
|
+
lt++;
|
|
63
|
+
}
|
|
64
|
+
else if (lt) {
|
|
65
|
+
lt--;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
while (ex && dt) {
|
|
69
|
+
const { 0: syntax, index } = ex;
|
|
70
|
+
if (syntax === '-{') {
|
|
71
|
+
if (!lc) {
|
|
72
|
+
const { lastIndex } = regex;
|
|
73
|
+
regex = /-\{|\}-/gu;
|
|
74
|
+
regex.lastIndex = lastIndex;
|
|
75
|
+
}
|
|
76
|
+
lc++;
|
|
77
|
+
}
|
|
78
|
+
else if (syntax === '}-') {
|
|
79
|
+
lc--;
|
|
80
|
+
if (!lc) {
|
|
81
|
+
const { lastIndex } = regex;
|
|
82
|
+
regex = fullRegex;
|
|
83
|
+
regex.lastIndex = lastIndex;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (syntax.endsWith('x\x7F')) {
|
|
87
|
+
const { name, closing, selfClosing } = accum[Number(syntax.slice(1, -2))];
|
|
88
|
+
if (!selfClosing || normalTags.includes(name)) {
|
|
89
|
+
update(closing);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (syntax.endsWith('q\x7F')) {
|
|
93
|
+
const { bold, italic } = accum[Number(syntax.slice(1, -2))];
|
|
94
|
+
if (bold) {
|
|
95
|
+
update(lb);
|
|
96
|
+
lb = !lb;
|
|
97
|
+
}
|
|
98
|
+
if (italic) {
|
|
99
|
+
update(li);
|
|
100
|
+
li = !li;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (lt === 0) { // syntax === ':'
|
|
104
|
+
if (syntax.length >= dt) {
|
|
105
|
+
return dd(syntax.slice(0, dt), index);
|
|
106
|
+
}
|
|
107
|
+
dt -= syntax.length;
|
|
108
|
+
regex.lastIndex = index + 4 + String(accum.length).length;
|
|
109
|
+
text = dd(syntax, index);
|
|
110
|
+
}
|
|
111
|
+
ex = regex.exec(text);
|
|
112
|
+
}
|
|
113
|
+
return text;
|
|
114
|
+
};
|
|
115
|
+
exports.parseList = parseList;
|
|
116
|
+
constants_1.parsers['parseList'] = __filename;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMagicLinks = void 0;
|
|
4
|
+
const string_1 = require("../util/string");
|
|
5
|
+
const magicLink_1 = require("../src/magicLink");
|
|
6
|
+
/* NOT FOR BROWSER */
|
|
7
|
+
const constants_1 = require("../util/constants");
|
|
8
|
+
/* NOT FOR BROWSER END */
|
|
9
|
+
const space = String.raw `[\p{Zs}\t]| |�*160;|�*a0;`, sp = `(?:${space})+`, spdash = `(?:${space}|-)`, magicLinkPattern = String.raw `(?:RFC|PMID)${sp}\d+\b|ISBN${sp}(?:97[89]${spdash}?)?(?:\d${spdash}?){9}[\dx]\b`;
|
|
10
|
+
/**
|
|
11
|
+
* 解析自由外链
|
|
12
|
+
* @param wikitext
|
|
13
|
+
* @param config
|
|
14
|
+
* @param accum
|
|
15
|
+
*/
|
|
16
|
+
const parseMagicLinks = (wikitext, config, accum) => {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
18
|
+
/(^|[^\p{L}\d_])(?:(?:ftp:\/\/|http:\/\/)((?:\[[\da-f:.]+\]|[^[\]<>"\t\n\p{Zs}])[^[\]<>"\0\t\n\p{Zs}]*)|(?:rfc|pmid)[\p{Zs}\t]+\d+\b|isbn[\p{Zs}\t]+(?:97[89][\p{Zs}\t-]?)?(?:\d[\p{Zs}\t-]?){9}[\dx]\b)/giu;
|
|
19
|
+
const regex = new RegExp(String.raw `(^|[^\p{L}\d_])(?:(?:${config.protocol})(${string_1.extUrlCharFirst}${string_1.extUrlChar})|${magicLinkPattern})`, 'giu');
|
|
20
|
+
return wikitext.replace(regex, (m, lead, p1) => {
|
|
21
|
+
let url = lead ? m.slice(lead.length) : m;
|
|
22
|
+
if (p1) {
|
|
23
|
+
let trail = '';
|
|
24
|
+
const m2 = /&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(url);
|
|
25
|
+
if (m2) {
|
|
26
|
+
trail = url.slice(m2.index);
|
|
27
|
+
url = url.slice(0, m2.index);
|
|
28
|
+
}
|
|
29
|
+
const sep = url.includes('(') ? /[^,;\\.:!?][,;\\.:!?]+$/u : /[^,;\\.:!?)][,;\\.:!?)]+$/u, sepChars = sep.exec(url);
|
|
30
|
+
if (sepChars) {
|
|
31
|
+
let correction = 1;
|
|
32
|
+
if (sepChars[0][1] === ';'
|
|
33
|
+
&& /&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(url.slice(0, sepChars.index))) {
|
|
34
|
+
correction = 2;
|
|
35
|
+
}
|
|
36
|
+
trail = url.slice(sepChars.index + correction) + trail;
|
|
37
|
+
url = url.slice(0, sepChars.index + correction);
|
|
38
|
+
}
|
|
39
|
+
if (trail.length >= p1.length) {
|
|
40
|
+
return m;
|
|
41
|
+
}
|
|
42
|
+
// @ts-expect-error abstract class
|
|
43
|
+
new magicLink_1.MagicLinkToken(url, undefined, config, accum);
|
|
44
|
+
return `${lead}\0${accum.length - 1}w\x7F${trail}`;
|
|
45
|
+
}
|
|
46
|
+
else if (!/^(?:RFC|PMID|ISBN)/u.test(url)) {
|
|
47
|
+
return m;
|
|
48
|
+
}
|
|
49
|
+
// @ts-expect-error abstract class
|
|
50
|
+
new magicLink_1.MagicLinkToken(url, 'magic-link', config, accum);
|
|
51
|
+
return `${lead}\0${accum.length - 1}i\x7F`;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
exports.parseMagicLinks = parseMagicLinks;
|
|
55
|
+
constants_1.parsers['parseMagicLinks'] = __filename;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseQuotes = void 0;
|
|
4
|
+
const quote_1 = require("../src/nowiki/quote");
|
|
5
|
+
/* NOT FOR BROWSER */
|
|
6
|
+
const constants_1 = require("../util/constants");
|
|
7
|
+
/* NOT FOR BROWSER END */
|
|
8
|
+
/**
|
|
9
|
+
* 解析单引号
|
|
10
|
+
* @param wikitext
|
|
11
|
+
* @param config
|
|
12
|
+
* @param accum
|
|
13
|
+
*/
|
|
14
|
+
const parseQuotes = (wikitext, config, accum) => {
|
|
15
|
+
const arr = wikitext.split(/('{2,})/u), { length } = arr;
|
|
16
|
+
if (length === 1) {
|
|
17
|
+
return wikitext;
|
|
18
|
+
}
|
|
19
|
+
let nBold = 0, nItalic = 0, firstSingle, firstMulti, firstSpace;
|
|
20
|
+
for (let i = 1; i < length; i += 2) {
|
|
21
|
+
const len = arr[i].length;
|
|
22
|
+
switch (len) {
|
|
23
|
+
case 2:
|
|
24
|
+
nItalic++;
|
|
25
|
+
break;
|
|
26
|
+
case 4:
|
|
27
|
+
arr[i - 1] += `'`;
|
|
28
|
+
arr[i] = `'''`;
|
|
29
|
+
// fall through
|
|
30
|
+
case 3:
|
|
31
|
+
nBold++;
|
|
32
|
+
if (firstSingle !== undefined) {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
else if (arr[i - 1].endsWith(' ')) {
|
|
36
|
+
if (firstMulti === undefined && firstSpace === undefined) {
|
|
37
|
+
firstSpace = i;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (arr[i - 1].slice(-2, -1) === ' ') {
|
|
41
|
+
firstSingle = i;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
firstMulti ??= i;
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
arr[i - 1] += `'`.repeat(len - 5);
|
|
49
|
+
arr[i] = `'''''`;
|
|
50
|
+
nItalic++;
|
|
51
|
+
nBold++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (nItalic % 2 === 1 && nBold % 2 === 1) {
|
|
55
|
+
const i = firstSingle ?? firstMulti ?? firstSpace;
|
|
56
|
+
if (i !== undefined) {
|
|
57
|
+
arr[i] = `''`;
|
|
58
|
+
arr[i - 1] += `'`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (let i = 1; i < length; i += 2) {
|
|
62
|
+
// @ts-expect-error abstract class
|
|
63
|
+
new quote_1.QuoteToken(arr[i], config, accum);
|
|
64
|
+
arr[i] = `\0${accum.length - 1}q\x7F`;
|
|
65
|
+
}
|
|
66
|
+
return arr.join('');
|
|
67
|
+
};
|
|
68
|
+
exports.parseQuotes = parseQuotes;
|
|
69
|
+
constants_1.parsers['parseQuotes'] = __filename;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRedirect = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
const redirect_1 = require("../src/redirect");
|
|
6
|
+
/* NOT FOR BROWSER */
|
|
7
|
+
const constants_1 = require("../util/constants");
|
|
8
|
+
/* NOT FOR BROWSER END */
|
|
9
|
+
/**
|
|
10
|
+
* 解析重定向
|
|
11
|
+
* @param text
|
|
12
|
+
* @param config
|
|
13
|
+
* @param accum
|
|
14
|
+
*/
|
|
15
|
+
const parseRedirect = (text, config, accum) => {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
17
|
+
/^(\s*)((?:#redirect|#重定向)\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)/iu;
|
|
18
|
+
const re = new RegExp(String.raw `^(\s*)((?:${config.redirection.join('|')})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`, 'iu'), mt = re.exec(text);
|
|
19
|
+
if (mt && index_1.default.normalizeTitle(mt[3], 0, false, config, true, true).valid) {
|
|
20
|
+
text = `\0${accum.length}o\x7F${text.slice(mt[0].length)}`;
|
|
21
|
+
// @ts-expect-error abstract class
|
|
22
|
+
new redirect_1.RedirectToken(...mt.slice(1), config, accum);
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
exports.parseRedirect = parseRedirect;
|
|
28
|
+
constants_1.parsers['parseRedirect'] = __filename;
|