wikiparser-node 1.13.1 → 1.13.2-b
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/bundle/bundle.min.js +37 -0
- package/config/default.json +31 -32
- package/config/enwiki.json +15 -829
- package/config/llwiki.json +21 -56
- package/config/moegirl.json +21 -65
- package/config/zhwiki.json +32 -498
- package/extensions/dist/base.js +163 -0
- package/extensions/dist/codejar.js +53 -0
- package/extensions/dist/editor.js +159 -0
- package/extensions/dist/highlight.js +30 -0
- package/extensions/dist/lint.js +72 -0
- package/extensions/editor.css +59 -0
- package/extensions/ui.css +162 -0
- package/package.json +28 -21
- package/config/.schema.json +0 -203
- package/dist/addon/table.js +0 -494
- package/dist/addon/token.js +0 -392
- package/dist/addon/transclude.js +0 -184
- package/dist/base.d.ts +0 -110
- package/dist/base.js +0 -67
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -279
- package/dist/internal.d.ts +0 -47
- package/dist/lib/element.d.ts +0 -125
- package/dist/lib/element.js +0 -364
- package/dist/lib/node.d.ts +0 -173
- package/dist/lib/node.js +0 -478
- package/dist/lib/range.d.ts +0 -105
- package/dist/lib/range.js +0 -406
- package/dist/lib/ranges.d.ts +0 -28
- package/dist/lib/ranges.js +0 -126
- package/dist/lib/rect.d.ts +0 -18
- package/dist/lib/rect.js +0 -36
- package/dist/lib/text.d.ts +0 -58
- package/dist/lib/text.js +0 -414
- package/dist/lib/title.d.ts +0 -49
- package/dist/lib/title.js +0 -251
- package/dist/mixin/attributesParent.d.ts +0 -49
- package/dist/mixin/attributesParent.js +0 -80
- package/dist/mixin/fixed.d.ts +0 -5
- package/dist/mixin/fixed.js +0 -32
- package/dist/mixin/flagsParent.d.ts +0 -43
- package/dist/mixin/flagsParent.js +0 -64
- package/dist/mixin/hidden.d.ts +0 -7
- package/dist/mixin/hidden.js +0 -39
- package/dist/mixin/magicLinkParent.d.ts +0 -19
- package/dist/mixin/magicLinkParent.js +0 -43
- package/dist/mixin/singleLine.d.ts +0 -5
- package/dist/mixin/singleLine.js +0 -25
- package/dist/mixin/sol.d.ts +0 -6
- package/dist/mixin/sol.js +0 -45
- package/dist/mixin/syntax.d.ts +0 -8
- package/dist/mixin/syntax.js +0 -46
- package/dist/parser/braces.js +0 -152
- package/dist/parser/commentAndExt.js +0 -84
- package/dist/parser/converter.js +0 -41
- package/dist/parser/externalLinks.js +0 -39
- package/dist/parser/hrAndDoubleUnderscore.js +0 -44
- package/dist/parser/html.js +0 -40
- package/dist/parser/links.js +0 -103
- package/dist/parser/list.js +0 -116
- package/dist/parser/magicLinks.js +0 -55
- package/dist/parser/quotes.js +0 -69
- package/dist/parser/redirect.js +0 -28
- package/dist/parser/selector.js +0 -443
- package/dist/parser/table.js +0 -125
- package/dist/src/arg.d.ts +0 -49
- package/dist/src/arg.js +0 -220
- package/dist/src/atom.d.ts +0 -14
- package/dist/src/atom.js +0 -54
- package/dist/src/attribute.d.ts +0 -64
- package/dist/src/attribute.js +0 -482
- package/dist/src/attributes.d.ts +0 -103
- package/dist/src/attributes.js +0 -383
- package/dist/src/converter.d.ts +0 -28
- package/dist/src/converter.js +0 -153
- package/dist/src/converterFlags.d.ts +0 -80
- package/dist/src/converterFlags.js +0 -241
- package/dist/src/converterRule.d.ts +0 -71
- package/dist/src/converterRule.js +0 -218
- package/dist/src/extLink.d.ts +0 -36
- package/dist/src/extLink.js +0 -223
- package/dist/src/gallery.d.ts +0 -51
- package/dist/src/gallery.js +0 -166
- package/dist/src/heading.d.ts +0 -44
- package/dist/src/heading.js +0 -222
- package/dist/src/hidden.d.ts +0 -9
- package/dist/src/hidden.js +0 -82
- package/dist/src/html.d.ts +0 -61
- package/dist/src/html.js +0 -344
- package/dist/src/imageParameter.d.ts +0 -60
- package/dist/src/imageParameter.js +0 -262
- package/dist/src/imagemap.d.ts +0 -47
- package/dist/src/imagemap.js +0 -148
- package/dist/src/imagemapLink.d.ts +0 -35
- package/dist/src/imagemapLink.js +0 -99
- package/dist/src/index.d.ts +0 -136
- package/dist/src/index.js +0 -790
- package/dist/src/link/base.d.ts +0 -52
- package/dist/src/link/base.js +0 -258
- package/dist/src/link/category.d.ts +0 -22
- package/dist/src/link/category.js +0 -36
- package/dist/src/link/file.d.ts +0 -102
- package/dist/src/link/file.js +0 -345
- package/dist/src/link/galleryImage.d.ts +0 -29
- package/dist/src/link/galleryImage.js +0 -133
- package/dist/src/link/index.d.ts +0 -39
- package/dist/src/link/index.js +0 -100
- package/dist/src/link/redirectTarget.d.ts +0 -27
- package/dist/src/link/redirectTarget.js +0 -71
- package/dist/src/magicLink.d.ts +0 -57
- package/dist/src/magicLink.js +0 -261
- package/dist/src/nested.d.ts +0 -40
- package/dist/src/nested.js +0 -108
- package/dist/src/nowiki/base.d.ts +0 -28
- package/dist/src/nowiki/base.js +0 -90
- package/dist/src/nowiki/comment.d.ts +0 -14
- package/dist/src/nowiki/comment.js +0 -123
- package/dist/src/nowiki/dd.d.ts +0 -8
- package/dist/src/nowiki/dd.js +0 -74
- package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
- package/dist/src/nowiki/doubleUnderscore.js +0 -101
- package/dist/src/nowiki/hr.d.ts +0 -5
- package/dist/src/nowiki/hr.js +0 -72
- package/dist/src/nowiki/index.d.ts +0 -14
- package/dist/src/nowiki/index.js +0 -30
- package/dist/src/nowiki/list.d.ts +0 -5
- package/dist/src/nowiki/list.js +0 -67
- package/dist/src/nowiki/listBase.d.ts +0 -23
- package/dist/src/nowiki/listBase.js +0 -100
- package/dist/src/nowiki/noinclude.d.ts +0 -6
- package/dist/src/nowiki/noinclude.js +0 -77
- package/dist/src/nowiki/quote.d.ts +0 -14
- package/dist/src/nowiki/quote.js +0 -149
- package/dist/src/onlyinclude.d.ts +0 -13
- package/dist/src/onlyinclude.js +0 -60
- package/dist/src/paramTag/index.d.ts +0 -28
- package/dist/src/paramTag/index.js +0 -80
- package/dist/src/paramTag/inputbox.d.ts +0 -8
- package/dist/src/paramTag/inputbox.js +0 -38
- package/dist/src/parameter.d.ts +0 -60
- package/dist/src/parameter.js +0 -267
- package/dist/src/pre.d.ts +0 -28
- package/dist/src/pre.js +0 -70
- package/dist/src/redirect.d.ts +0 -30
- package/dist/src/redirect.js +0 -128
- package/dist/src/syntax.d.ts +0 -15
- package/dist/src/syntax.js +0 -87
- package/dist/src/table/base.d.ts +0 -28
- package/dist/src/table/base.js +0 -81
- package/dist/src/table/index.d.ts +0 -230
- package/dist/src/table/index.js +0 -506
- package/dist/src/table/td.d.ts +0 -72
- package/dist/src/table/td.js +0 -375
- package/dist/src/table/tr.d.ts +0 -30
- package/dist/src/table/tr.js +0 -61
- package/dist/src/table/trBase.d.ts +0 -49
- package/dist/src/table/trBase.js +0 -165
- package/dist/src/tagPair/ext.d.ts +0 -29
- package/dist/src/tagPair/ext.js +0 -229
- package/dist/src/tagPair/include.d.ts +0 -33
- package/dist/src/tagPair/include.js +0 -145
- package/dist/src/tagPair/index.d.ts +0 -23
- package/dist/src/tagPair/index.js +0 -130
- package/dist/src/transclude.d.ts +0 -159
- package/dist/src/transclude.js +0 -598
- package/dist/util/constants.js +0 -26
- package/dist/util/debug.js +0 -95
- package/dist/util/diff.js +0 -83
- package/dist/util/html.js +0 -146
- package/dist/util/lint.js +0 -32
- package/dist/util/string.js +0 -107
- package/errors/README +0 -3
- package/printed/README +0 -3
package/dist/parser/list.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
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;
|
|
@@ -1,55 +0,0 @@
|
|
|
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;
|
package/dist/parser/quotes.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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;
|
package/dist/parser/redirect.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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;
|