wikiparser-node 1.32.0 → 1.34.0

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.
Files changed (90) hide show
  1. package/README.md +7 -0
  2. package/bundle/bundle-es8.min.js +28 -28
  3. package/bundle/bundle-lsp.min.js +29 -29
  4. package/bundle/bundle.min.js +24 -24
  5. package/coverage/badge.svg +1 -1
  6. package/dist/addon/attribute.js +27 -7
  7. package/dist/addon/link.js +15 -16
  8. package/dist/addon/table.js +139 -103
  9. package/dist/addon/token.js +3 -1
  10. package/dist/base.d.mts +1 -1
  11. package/dist/base.d.ts +1 -1
  12. package/dist/base.js +1 -0
  13. package/dist/base.mjs +1 -0
  14. package/dist/bin/config.js +1 -1
  15. package/dist/index.js +10 -10
  16. package/dist/internal.d.ts +3 -0
  17. package/dist/lib/lintConfig.js +8 -0
  18. package/dist/lib/lsp.js +20 -3
  19. package/dist/lib/node.js +3 -11
  20. package/dist/lib/text.js +18 -18
  21. package/dist/lib/title.js +8 -10
  22. package/dist/render/magicWords.js +13 -6
  23. package/dist/src/attribute.d.ts +4 -6
  24. package/dist/src/attribute.js +15 -11
  25. package/dist/src/attributes.d.ts +2 -2
  26. package/dist/src/attributes.js +11 -6
  27. package/dist/src/converterFlags.js +5 -7
  28. package/dist/src/imageParameter.d.ts +7 -3
  29. package/dist/src/imageParameter.js +15 -5
  30. package/dist/src/index.d.ts +8 -0
  31. package/dist/src/index.js +34 -21
  32. package/dist/src/link/base.d.ts +1 -1
  33. package/dist/src/link/base.js +12 -5
  34. package/dist/src/link/categorytree.d.ts +25 -0
  35. package/dist/src/link/categorytree.js +126 -0
  36. package/dist/src/link/file.d.ts +3 -2
  37. package/dist/src/link/file.js +4 -3
  38. package/dist/src/link/galleryImage.js +6 -7
  39. package/dist/src/multiLine/gallery.d.ts +1 -4
  40. package/dist/src/multiLine/gallery.js +1 -11
  41. package/dist/src/multiLine/imagemap.d.ts +0 -1
  42. package/dist/src/multiLine/imagemap.js +98 -152
  43. package/dist/src/multiLine/index.d.ts +1 -0
  44. package/dist/src/multiLine/index.js +77 -22
  45. package/dist/src/multiLine/inputbox.d.ts +3 -3
  46. package/dist/src/multiLine/inputbox.js +3 -7
  47. package/dist/src/multiLine/paramTag.d.ts +3 -4
  48. package/dist/src/multiLine/paramTag.js +6 -48
  49. package/dist/src/nowiki/index.d.ts +1 -1
  50. package/dist/src/nowiki/index.js +59 -13
  51. package/dist/src/nowiki/list.d.ts +0 -1
  52. package/dist/src/nowiki/list.js +1 -0
  53. package/dist/src/nowiki/noinclude.d.ts +0 -1
  54. package/dist/src/nowiki/noinclude.js +1 -0
  55. package/dist/src/nowiki/quote.d.ts +0 -4
  56. package/dist/src/nowiki/quote.js +4 -0
  57. package/dist/src/paramLine.d.ts +3 -0
  58. package/dist/src/paramLine.js +45 -7
  59. package/dist/src/parameter.js +5 -7
  60. package/dist/src/table/base.d.ts +1 -2
  61. package/dist/src/table/base.js +7 -8
  62. package/dist/src/table/index.d.ts +2 -3
  63. package/dist/src/table/index.js +4 -41
  64. package/dist/src/table/td.d.ts +0 -1
  65. package/dist/src/table/td.js +1 -0
  66. package/dist/src/table/tr.d.ts +1 -1
  67. package/dist/src/tag/html.d.ts +0 -1
  68. package/dist/src/tag/html.js +1 -0
  69. package/dist/src/tag/tvar.d.ts +0 -1
  70. package/dist/src/tag/tvar.js +1 -0
  71. package/dist/src/tagPair/ext.js +19 -10
  72. package/dist/src/tagPair/index.d.ts +4 -2
  73. package/dist/src/tagPair/index.js +47 -7
  74. package/dist/src/tagPair/translate.d.ts +1 -1
  75. package/dist/src/tagPair/translate.js +3 -1
  76. package/dist/src/transclude.js +2 -2
  77. package/dist/util/debug.js +10 -3
  78. package/dist/util/diff.js +6 -17
  79. package/dist/util/html.js +1 -0
  80. package/dist/util/sharable.d.mts +1 -0
  81. package/dist/util/sharable.js +62 -1
  82. package/dist/util/sharable.mjs +62 -0
  83. package/extensions/dist/base.js +1 -1
  84. package/extensions/typings.d.ts +40 -0
  85. package/extensions/ui.css +1 -1
  86. package/i18n/en.json +2 -0
  87. package/i18n/zh-hans.json +2 -0
  88. package/i18n/zh-hant.json +2 -0
  89. package/logo.png +0 -0
  90. package/package.json +7 -6
@@ -1,38 +1,4 @@
1
1
  "use strict";
2
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
- var useValue = arguments.length > 2;
4
- for (var i = 0; i < initializers.length; i++) {
5
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
- }
7
- return useValue ? value : void 0;
8
- };
9
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
- var _, done = false;
15
- for (var i = decorators.length - 1; i >= 0; i--) {
16
- var context = {};
17
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
- if (kind === "accessor") {
22
- if (result === void 0) continue;
23
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
- if (_ = accept(result.get)) descriptor.get = _;
25
- if (_ = accept(result.set)) descriptor.set = _;
26
- if (_ = accept(result.init)) initializers.unshift(_);
27
- }
28
- else if (_ = accept(result)) {
29
- if (kind === "field") initializers.unshift(_);
30
- else descriptor[key] = _;
31
- }
32
- }
33
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
- done = true;
35
- };
36
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
4
  };
@@ -48,146 +14,126 @@ const galleryImage_1 = require("../link/galleryImage");
48
14
  const imagemapLink_1 = require("../imagemapLink");
49
15
  /* NOT FOR BROWSER */
50
16
  const constants_1 = require("../../util/constants");
51
- const clone_1 = require("../../mixin/clone");
52
17
  /* NOT FOR BROWSER END */
53
18
  /**
54
19
  * `<imagemap>`
55
20
  * @classdesc `{childNodes: [...CommentLineToken[], GalleryImageToken, ...(CommentLineToken|ImagemapLinkToken|AstText)[]]}`
56
21
  */
57
- let ImagemapToken = (() => {
58
- let _classSuper = index_2.MultiLineToken;
59
- let _instanceExtraInitializers = [];
60
- let _cloneNode_decorators;
61
- return class ImagemapToken extends _classSuper {
62
- static {
63
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
64
- _cloneNode_decorators = [clone_1.clone];
65
- __esDecorate(this, null, _cloneNode_decorators, { kind: "method", name: "cloneNode", static: false, private: false, access: { has: obj => "cloneNode" in obj, get: obj => obj.cloneNode }, metadata: _metadata }, null, _instanceExtraInitializers);
66
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
67
- }
68
- /* NOT FOR BROWSER END */
69
- /** 图片 */
70
- get image() {
71
- return this.childNodes.find((0, debug_1.isToken)('imagemap-image'));
22
+ class ImagemapToken extends index_2.MultiLineToken {
23
+ /* NOT FOR BROWSER END */
24
+ /** 图片 */
25
+ get image() {
26
+ return this.childNodes.find((0, debug_1.isToken)('imagemap-image'));
27
+ }
28
+ /** @param inner 标签内部wikitext */
29
+ constructor(inner, config = index_1.default.getConfig(), accum = []) {
30
+ super(undefined, config, accum, {
31
+ GalleryImageToken: ':', ImagemapLinkToken: ':', CommentLineToken: ':', AstText: ':',
32
+ });
33
+ if (!inner) {
34
+ return;
72
35
  }
73
- /** @param inner 标签内部wikitext */
74
- constructor(inner, config = index_1.default.getConfig(), accum = []) {
75
- super(undefined, config, accum, {
76
- GalleryImageToken: ':', ImagemapLinkToken: ':', CommentLineToken: ':', AstText: ':',
77
- });
78
- __runInitializers(this, _instanceExtraInitializers);
79
- if (!inner) {
80
- return;
36
+ const lines = inner.split('\n'), protocols = new Set(config.protocol.split('|'));
37
+ let first = true, error = false;
38
+ for (const line of lines) {
39
+ const trimmed = line.trim();
40
+ if (error || !trimmed || trimmed.startsWith('#')) {
41
+ //
81
42
  }
82
- const lines = inner.split('\n'), protocols = new Set(config.protocol.split('|'));
83
- let first = true, error = false;
84
- for (const line of lines) {
85
- const trimmed = line.trim();
86
- if (error || !trimmed || trimmed.startsWith('#')) {
87
- //
43
+ else if (first) {
44
+ const pipe = line.indexOf('|'), file = pipe === -1 ? line : line.slice(0, pipe), title = this.normalizeTitle(file, 0, { halfParsed: true, temporary: true, page: '' });
45
+ if (title.valid && title.ns === 6
46
+ && !title.interwiki) {
47
+ // @ts-expect-error abstract class
48
+ const token = new galleryImage_1.GalleryImageToken('imagemap', file, pipe === -1 ? undefined : line.slice(pipe + 1), config, accum);
49
+ super.insertAt(token);
50
+ first = false;
51
+ continue;
88
52
  }
89
- else if (first) {
90
- const pipe = line.indexOf('|'), file = pipe === -1 ? line : line.slice(0, pipe), { valid, ns,
91
- /* NOT FOR BROWSER */
92
- interwiki, } = this.normalizeTitle(file, 0, { halfParsed: true, temporary: true, page: '' });
93
- if (valid
94
- && !interwiki
95
- && ns === 6) {
53
+ else {
54
+ error = true;
55
+ }
56
+ }
57
+ else if (line.trim().split(/[\t ]/u, 1)[0] === 'desc') {
58
+ super.insertAt(line);
59
+ continue;
60
+ }
61
+ else if (line.includes('[')) {
62
+ const i = line.indexOf('['), substr = line.slice(i), mtIn = /^\[\[([^|]+)(?:\|([^\]]*))?\]\][\w\s]*$/u
63
+ .exec(substr);
64
+ if (mtIn) {
65
+ if (this.normalizeTitle(mtIn[1], 0, { halfParsed: true, temporary: true, selfLink: true, page: '' }).valid) {
96
66
  // @ts-expect-error abstract class
97
- const token = new galleryImage_1.GalleryImageToken('imagemap', file, pipe === -1 ? undefined : line.slice(pipe + 1), config, accum);
98
- super.insertAt(token);
99
- first = false;
67
+ super.insertAt(new imagemapLink_1.ImagemapLinkToken(line.slice(0, i), mtIn.slice(1), substr.slice(substr.indexOf(']]') + 2), config, accum));
100
68
  continue;
101
69
  }
102
- else {
103
- error = true;
104
- }
105
70
  }
106
- else if (line.trim().split(/[\t ]/u, 1)[0] === 'desc') {
107
- super.insertAt(line);
108
- continue;
109
- }
110
- else if (line.includes('[')) {
111
- const i = line.indexOf('['), substr = line.slice(i), mtIn = /^\[\[([^|]+)(?:\|([^\]]*))?\]\][\w\s]*$/u
71
+ else if (substr.startsWith('[//')
72
+ || protocols.has(substr.slice(1, substr.indexOf(':') + 1))
73
+ || protocols.has(substr.slice(1, substr.indexOf('//') + 2))) {
74
+ const mtEx = /^\[([^\]\s]+)(?:(\s+(?!\s))([^\]]*))?\][\w\s]*$/u
112
75
  .exec(substr);
113
- if (mtIn) {
114
- if (this.normalizeTitle(mtIn[1], 0, { halfParsed: true, temporary: true, selfLink: true, page: '' }).valid) {
115
- // @ts-expect-error abstract class
116
- super.insertAt(new imagemapLink_1.ImagemapLinkToken(line.slice(0, i), mtIn.slice(1), substr.slice(substr.indexOf(']]') + 2), config, accum));
117
- continue;
118
- }
119
- }
120
- else if (substr.startsWith('[//')
121
- || protocols.has(substr.slice(1, substr.indexOf(':') + 1))
122
- || protocols.has(substr.slice(1, substr.indexOf('//') + 2))) {
123
- const mtEx = /^\[([^\]\s]+)(?:(\s+(?!\s))([^\]]*))?\][\w\s]*$/u
124
- .exec(substr);
125
- if (mtEx) {
126
- // @ts-expect-error abstract class
127
- super.insertAt(new imagemapLink_1.ImagemapLinkToken(line.slice(0, i), mtEx.slice(1), substr.slice(substr.indexOf(']') + 1), config, accum));
128
- continue;
129
- }
76
+ if (mtEx) {
77
+ // @ts-expect-error abstract class
78
+ super.insertAt(new imagemapLink_1.ImagemapLinkToken(line.slice(0, i), mtEx.slice(1), substr.slice(substr.indexOf(']') + 1), config, accum));
79
+ continue;
130
80
  }
131
81
  }
132
- // @ts-expect-error abstract class
133
- super.insertAt(new commentLine_1.CommentLineToken(line, config, accum));
134
82
  }
83
+ // @ts-expect-error abstract class
84
+ super.insertAt(new commentLine_1.CommentLineToken(line, config, accum));
135
85
  }
136
- /** @private */
137
- lint(start = this.getAbsoluteIndex(), re) {
138
- LINT: {
139
- const errors = super.lint(start, re), rect = new rect_1.BoundingRect(this, start), { childNodes, image } = this, rule = 'invalid-imagemap', { lintConfig } = index_1.default, s = lintConfig.getSeverity(rule, image ? 'link' : 'image');
140
- if (s) {
141
- if (image) {
142
- Array.prototype.push.apply(errors, childNodes.filter(child => {
143
- const str = child.toString().trim();
144
- return child.is('noinclude')
145
- && str && !str.startsWith('#');
146
- }).map(child => {
147
- const e = (0, lint_1.generateForChild)(child, rect, rule, 'invalid-imagemap-link', s);
148
- if (lintConfig.computeEditInfo) {
149
- e.suggestions = [
150
- (0, lint_1.fixByRemove)(e, -1),
151
- (0, lint_1.fixBy)(e, 'comment', '# '),
152
- ];
153
- }
154
- return e;
155
- }));
156
- }
157
- else {
158
- errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'imagemap-without-image', s));
159
- }
86
+ }
87
+ /** @private */
88
+ lint(start = this.getAbsoluteIndex(), re) {
89
+ LINT: {
90
+ const errors = super.lint(start, re), rect = new rect_1.BoundingRect(this, start), { childNodes, image } = this, rule = 'invalid-imagemap', { lintConfig } = index_1.default, s = lintConfig.getSeverity(rule, image ? 'link' : 'image');
91
+ if (s) {
92
+ if (image) {
93
+ Array.prototype.push.apply(errors, childNodes.filter(child => {
94
+ const str = child.toString().trim();
95
+ return child.is('noinclude')
96
+ && str && !str.startsWith('#');
97
+ }).map(child => {
98
+ const e = (0, lint_1.generateForChild)(child, rect, rule, 'invalid-imagemap-link', s);
99
+ if (lintConfig.computeEditInfo) {
100
+ e.suggestions = [
101
+ (0, lint_1.fixByRemove)(e, -1),
102
+ (0, lint_1.fixBy)(e, 'comment', '# '),
103
+ ];
104
+ }
105
+ return e;
106
+ }));
107
+ }
108
+ else {
109
+ errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'imagemap-without-image', s));
160
110
  }
161
- return errors;
162
111
  }
112
+ return errors;
163
113
  }
164
- /* PRINT ONLY */
165
- /** @private */
166
- getAttribute(key) {
167
- return key === 'invalid' ? !this.image : super.getAttribute(key);
168
- }
169
- insertAt(token, i) {
170
- const { image } = this;
171
- if (!image && (typeof token === 'string' || token.is('imagemap-link') || token.type === 'text')) {
172
- throw new Error('Missing a valid image!');
173
- }
174
- else if (image && typeof token !== 'string' && token.is('imagemap-image')) {
175
- throw new RangeError('Already have a valid image!');
176
- }
177
- return super.insertAt(token, i);
114
+ }
115
+ /* PRINT ONLY */
116
+ /** @private */
117
+ getAttribute(key) {
118
+ return key === 'invalid' ? !this.image : super.getAttribute(key);
119
+ }
120
+ insertAt(token, i) {
121
+ const { image } = this;
122
+ if (!image && (typeof token === 'string' || token.is('imagemap-link') || token.type === 'text')) {
123
+ throw new Error('Missing a valid image!');
178
124
  }
179
- /** @private */
180
- removeAt(i) {
181
- if (this.childNodes[i]?.is('imagemap-image')) {
182
- throw new Error('Do not remove the image in <imagemap>!');
183
- }
184
- return super.removeAt(i);
125
+ else if (image && typeof token !== 'string' && token.is('imagemap-image')) {
126
+ throw new RangeError('Already have a valid image!');
185
127
  }
186
- cloneNode() {
187
- // @ts-expect-error abstract class
188
- return new ImagemapToken(undefined, this.getAttribute('config'));
128
+ return super.insertAt(token, i);
129
+ }
130
+ /** @private */
131
+ removeAt(i) {
132
+ if (!this.parentNode?.selfClosing && this.childNodes[i]?.is('imagemap-image')) {
133
+ throw new Error('Do not remove the image in <imagemap>!');
189
134
  }
190
- };
191
- })();
135
+ return super.removeAt(i);
136
+ }
137
+ }
192
138
  exports.ImagemapToken = ImagemapToken;
193
139
  constants_1.classes['ImagemapToken'] = __filename;
@@ -14,4 +14,5 @@ export declare abstract class MultiLineToken extends Token {
14
14
  abstract get previousElementSibling(): AttributesToken | undefined;
15
15
  abstract get parentElement(): ExtToken | undefined;
16
16
  get type(): 'ext-inner';
17
+ cloneNode(): this;
17
18
  }
@@ -1,36 +1,91 @@
1
1
  "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
2
36
  Object.defineProperty(exports, "__esModule", { value: true });
3
37
  exports.MultiLineToken = void 0;
4
38
  const index_1 = require("../index");
5
39
  /* NOT FOR BROWSER */
6
40
  const constants_1 = require("../../util/constants");
41
+ const clone_1 = require("../../mixin/clone");
7
42
  /* NOT FOR BROWSER END */
8
43
  /**
9
44
  * extension tag that is parsed line by line
10
45
  *
11
46
  * 逐行解析的扩展标签
12
47
  */
13
- class MultiLineToken extends index_1.Token {
14
- /* NOT FOR BROWSER END */
15
- get type() {
16
- return 'ext-inner';
17
- }
18
- /** @private */
19
- toString(skip) {
20
- return super.toString(skip, '\n');
21
- }
22
- /** @private */
23
- text() {
24
- return super.text('\n').replace(/\n\s*\n/gu, '\n');
25
- }
26
- /** @private */
27
- getGaps() {
28
- return 1;
29
- }
30
- /** @private */
31
- print() {
32
- PRINT: return super.print({ sep: '\n' });
33
- }
34
- }
48
+ let MultiLineToken = (() => {
49
+ let _classSuper = index_1.Token;
50
+ let _instanceExtraInitializers = [];
51
+ let _cloneNode_decorators;
52
+ return class MultiLineToken extends _classSuper {
53
+ static {
54
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
+ _cloneNode_decorators = [clone_1.clone];
56
+ __esDecorate(this, null, _cloneNode_decorators, { kind: "method", name: "cloneNode", static: false, private: false, access: { has: obj => "cloneNode" in obj, get: obj => obj.cloneNode }, metadata: _metadata }, null, _instanceExtraInitializers);
57
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
+ }
59
+ /* NOT FOR BROWSER END */
60
+ get type() {
61
+ return 'ext-inner';
62
+ }
63
+ /** @private */
64
+ toString(skip) {
65
+ return super.toString(skip, '\n');
66
+ }
67
+ /** @private */
68
+ text() {
69
+ return super.text('\n').replace(/\n\s*\n/gu, '\n');
70
+ }
71
+ /** @private */
72
+ getGaps() {
73
+ return 1;
74
+ }
75
+ /** @private */
76
+ print() {
77
+ PRINT: return super.print({ sep: '\n' });
78
+ }
79
+ /* NOT FOR BROWSER */
80
+ cloneNode() {
81
+ const C = this.constructor;
82
+ return new C(undefined, this.getAttribute('config'));
83
+ }
84
+ constructor() {
85
+ super(...arguments);
86
+ __runInitializers(this, _instanceExtraInitializers);
87
+ }
88
+ };
89
+ })();
35
90
  exports.MultiLineToken = MultiLineToken;
36
91
  constants_1.classes['MultiLineToken'] = __filename;
@@ -1,8 +1,8 @@
1
- import Parser from '../../index';
2
1
  import { ParamTagToken } from './paramTag';
2
+ import type { Config } from '../../base';
3
3
  import type { Token } from '../../internal';
4
4
  /** `<inputbox>` */
5
5
  export declare abstract class InputboxToken extends ParamTagToken {
6
- /** @class */
7
- constructor(include: boolean, wikitext?: string, config?: Parser.Config, accum?: Token[]);
6
+ /** @param name 扩展标签名 */
7
+ constructor(name: string, include: boolean, wikitext: string | undefined, config: Config, accum?: Token[]);
8
8
  }
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.InputboxToken = void 0;
7
4
  const commentAndExt_1 = require("../../parser/commentAndExt");
8
5
  const braces_1 = require("../../parser/braces");
9
- const index_1 = __importDefault(require("../../index"));
10
6
  const paramTag_1 = require("./paramTag");
11
7
  /* NOT FOR BROWSER */
12
8
  const constants_1 = require("../../util/constants");
13
9
  /* NOT FOR BROWSER END */
14
10
  /** `<inputbox>` */
15
11
  class InputboxToken extends paramTag_1.ParamTagToken {
16
- /** @class */
17
- constructor(include, wikitext, config = index_1.default.getConfig(), accum = []) {
12
+ /** @param name 扩展标签名 */
13
+ constructor(name, include, wikitext, config, accum = []) {
18
14
  const placeholder = Symbol('InputboxToken'), newConfig = config.excludes.includes('heading')
19
15
  ? config
20
16
  : {
@@ -25,7 +21,7 @@ class InputboxToken extends paramTag_1.ParamTagToken {
25
21
  wikitext &&= (0, commentAndExt_1.parseCommentAndExt)(wikitext, newConfig, accum, include);
26
22
  wikitext &&= (0, braces_1.parseBraces)(wikitext, newConfig, accum);
27
23
  accum.splice(length, 1);
28
- super(include, wikitext, newConfig, accum, {
24
+ super(name, include, wikitext, newConfig, accum, {
29
25
  ArgToken: ':', TranscludeToken: ':',
30
26
  });
31
27
  }
@@ -1,7 +1,6 @@
1
- import Parser from '../../index';
2
1
  import { MultiLineToken } from './index';
3
2
  import { ParamLineToken } from '../paramLine';
4
- import type { LintError } from '../../base';
3
+ import type { Config } from '../../base';
5
4
  import type { Token } from '../../internal';
6
5
  /**
7
6
  * `<dynamicpagelist>`
@@ -14,7 +13,7 @@ export declare abstract class ParamTagToken extends MultiLineToken {
14
13
  abstract get children(): ParamLineToken[];
15
14
  abstract get firstElementChild(): ParamLineToken | undefined;
16
15
  abstract get lastElementChild(): ParamLineToken | undefined;
17
- /** @class */
18
- constructor(include: boolean, wikitext?: string, config?: Parser.Config, accum?: Token[], acceptable?: WikiParserAcceptable);
16
+ /** @param name 扩展标签名 */
17
+ constructor(name: string, include: boolean, wikitext: string | undefined, config: Config, accum?: Token[], acceptable?: WikiParserAcceptable);
19
18
  cloneNode(): this;
20
19
  }
@@ -33,16 +33,10 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
33
33
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
34
  done = true;
35
35
  };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  Object.defineProperty(exports, "__esModule", { value: true });
40
37
  exports.ParamTagToken = void 0;
41
- const lint_1 = require("../../util/lint");
42
- const rect_1 = require("../../lib/rect");
43
38
  const commentAndExt_1 = require("../../parser/commentAndExt");
44
- const index_1 = __importDefault(require("../../index"));
45
- const index_2 = require("./index");
39
+ const index_1 = require("./index");
46
40
  const paramLine_1 = require("../paramLine");
47
41
  /* NOT FOR BROWSER */
48
42
  const constants_1 = require("../../util/constants");
@@ -53,7 +47,7 @@ const clone_1 = require("../../mixin/clone");
53
47
  * @classdesc `{childNodes: ParamLineToken[]}`
54
48
  */
55
49
  let ParamTagToken = (() => {
56
- let _classSuper = index_2.MultiLineToken;
50
+ let _classSuper = index_1.MultiLineToken;
57
51
  let _instanceExtraInitializers = [];
58
52
  let _cloneNode_decorators;
59
53
  return class ParamTagToken extends _classSuper {
@@ -64,8 +58,8 @@ let ParamTagToken = (() => {
64
58
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
65
59
  }
66
60
  /* NOT FOR BROWSER END */
67
- /** @class */
68
- constructor(include, wikitext, config = index_1.default.getConfig(), accum = [], acceptable) {
61
+ /** @param name 扩展标签名 */
62
+ constructor(name, include, wikitext, config, accum = [], acceptable) {
69
63
  super(undefined, config, accum, {
70
64
  ParamLineToken: ':',
71
65
  });
@@ -74,53 +68,17 @@ let ParamTagToken = (() => {
74
68
  this.safeAppend(wikitext.split('\n')
75
69
  .map(line => acceptable ? line : (0, commentAndExt_1.parseCommentAndExt)(line, config, accum, include))
76
70
  // @ts-expect-error abstract class
77
- .map((line) => new paramLine_1.ParamLineToken(line, config, accum, {
71
+ .map((line) => new paramLine_1.ParamLineToken(name, line, config, accum, {
78
72
  'Stage-1': ':', ...acceptable ?? { '!ExtToken': '' },
79
73
  })));
80
74
  }
81
75
  accum.splice(accum.indexOf(this), 1);
82
76
  accum.push(this);
83
77
  }
84
- /** @private */
85
- lint(start = this.getAbsoluteIndex()) {
86
- LINT: {
87
- const rule = 'no-ignored', { lintConfig } = index_1.default, s = lintConfig.getSeverity(rule, this.name);
88
- if (!s) {
89
- return [];
90
- }
91
- const rect = new rect_1.BoundingRect(this, start), msg = index_1.default.msg('invalid-parameter', this.name), errors = [];
92
- for (const child of this.childNodes) {
93
- child.setAttribute('aIndex', start);
94
- const grandChildren = child.childNodes
95
- .filter(({ type }) => type !== 'comment' && type !== 'include' && type !== 'noinclude');
96
- if (grandChildren.some(({ type }) => type === 'ext')) {
97
- errors.push((0, lint_1.generateForChild)(child, rect, rule, msg, s));
98
- }
99
- else {
100
- const i = grandChildren.findIndex(({ type }) => type !== 'text'), str = grandChildren.slice(0, i === -1 ? undefined : i).map(String).join('');
101
- if (str && !(i === -1 ? /^[a-z]+(?:\[\])?\s*=/iu : /^[a-z]+(?:\[\])?\s*(?:=|$)/iu).test(str)) {
102
- const e = (0, lint_1.generateForChild)(child, rect, rule, msg, s);
103
- if (lintConfig.computeEditInfo) {
104
- e.suggestions = [(0, lint_1.fixByRemove)(e)];
105
- }
106
- errors.push(e);
107
- }
108
- else {
109
- const childErrors = child.lint(start, false);
110
- if (childErrors.length > 0) {
111
- Array.prototype.push.apply(errors, childErrors);
112
- }
113
- }
114
- }
115
- start += child.toString().length + 1;
116
- }
117
- return errors;
118
- }
119
- }
120
78
  /* NOT FOR BROWSER */
121
79
  cloneNode() {
122
80
  const C = this.constructor;
123
- return new C(this.getAttribute('include'), undefined, this.getAttribute('config'));
81
+ return new C(this.name, this.getAttribute('include'), undefined, this.getAttribute('config'));
124
82
  }
125
83
  };
126
84
  })();
@@ -1,6 +1,6 @@
1
1
  import { NowikiBaseToken } from './base';
2
2
  import type { LintError } from '../../base';
3
- import type { AttributesToken, ExtToken } from '../../internal';
3
+ import type { AttributesToken, ExtToken, AstNodes } from '../../internal';
4
4
  /**
5
5
  * text-only token inside an extension tag
6
6
  *