wikiparser-node 1.11.1 → 1.12.0-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.
Files changed (175) hide show
  1. package/bundle/bundle.min.js +37 -0
  2. package/config/default.json +28 -28
  3. package/config/enwiki.json +14 -827
  4. package/config/llwiki.json +20 -54
  5. package/config/minimum.json +1 -1
  6. package/config/moegirl.json +20 -63
  7. package/config/zhwiki.json +27 -492
  8. package/extensions/dist/base.js +162 -0
  9. package/extensions/dist/codejar.js +52 -0
  10. package/extensions/dist/editor.js +159 -0
  11. package/extensions/dist/highlight.js +30 -0
  12. package/extensions/dist/lint.js +72 -0
  13. package/extensions/editor.css +59 -0
  14. package/extensions/ui.css +159 -0
  15. package/package.json +29 -21
  16. package/config/.schema.json +0 -186
  17. package/dist/addon/table.js +0 -486
  18. package/dist/addon/token.js +0 -304
  19. package/dist/addon/transclude.js +0 -184
  20. package/dist/base.d.ts +0 -81
  21. package/dist/base.js +0 -39
  22. package/dist/index.d.ts +0 -33
  23. package/dist/index.js +0 -235
  24. package/dist/internal.d.ts +0 -46
  25. package/dist/lib/element.d.ts +0 -125
  26. package/dist/lib/element.js +0 -375
  27. package/dist/lib/node.d.ts +0 -173
  28. package/dist/lib/node.js +0 -477
  29. package/dist/lib/range.d.ts +0 -105
  30. package/dist/lib/range.js +0 -406
  31. package/dist/lib/ranges.d.ts +0 -28
  32. package/dist/lib/ranges.js +0 -126
  33. package/dist/lib/rect.d.ts +0 -18
  34. package/dist/lib/rect.js +0 -34
  35. package/dist/lib/text.d.ts +0 -58
  36. package/dist/lib/text.js +0 -400
  37. package/dist/lib/title.d.ts +0 -42
  38. package/dist/lib/title.js +0 -208
  39. package/dist/mixin/attributesParent.d.ts +0 -49
  40. package/dist/mixin/attributesParent.js +0 -79
  41. package/dist/mixin/fixed.d.ts +0 -5
  42. package/dist/mixin/fixed.js +0 -32
  43. package/dist/mixin/flagsParent.d.ts +0 -43
  44. package/dist/mixin/flagsParent.js +0 -64
  45. package/dist/mixin/hidden.d.ts +0 -7
  46. package/dist/mixin/hidden.js +0 -37
  47. package/dist/mixin/magicLinkParent.d.ts +0 -19
  48. package/dist/mixin/magicLinkParent.js +0 -43
  49. package/dist/mixin/singleLine.d.ts +0 -5
  50. package/dist/mixin/singleLine.js +0 -25
  51. package/dist/mixin/sol.d.ts +0 -6
  52. package/dist/mixin/sol.js +0 -45
  53. package/dist/mixin/syntax.d.ts +0 -8
  54. package/dist/mixin/syntax.js +0 -46
  55. package/dist/parser/braces.js +0 -150
  56. package/dist/parser/commentAndExt.js +0 -79
  57. package/dist/parser/converter.js +0 -39
  58. package/dist/parser/externalLinks.js +0 -37
  59. package/dist/parser/hrAndDoubleUnderscore.js +0 -42
  60. package/dist/parser/html.js +0 -38
  61. package/dist/parser/links.js +0 -101
  62. package/dist/parser/list.js +0 -114
  63. package/dist/parser/magicLinks.js +0 -52
  64. package/dist/parser/quotes.js +0 -67
  65. package/dist/parser/redirect.js +0 -26
  66. package/dist/parser/selector.js +0 -394
  67. package/dist/parser/table.js +0 -123
  68. package/dist/src/arg.d.ts +0 -51
  69. package/dist/src/arg.js +0 -214
  70. package/dist/src/atom.d.ts +0 -14
  71. package/dist/src/atom.js +0 -52
  72. package/dist/src/attribute.d.ts +0 -64
  73. package/dist/src/attribute.js +0 -480
  74. package/dist/src/attributes.d.ts +0 -101
  75. package/dist/src/attributes.js +0 -381
  76. package/dist/src/converter.d.ts +0 -28
  77. package/dist/src/converter.js +0 -148
  78. package/dist/src/converterFlags.d.ts +0 -80
  79. package/dist/src/converterFlags.js +0 -239
  80. package/dist/src/converterRule.d.ts +0 -71
  81. package/dist/src/converterRule.js +0 -216
  82. package/dist/src/extLink.d.ts +0 -36
  83. package/dist/src/extLink.js +0 -218
  84. package/dist/src/gallery.d.ts +0 -47
  85. package/dist/src/gallery.js +0 -143
  86. package/dist/src/heading.d.ts +0 -40
  87. package/dist/src/heading.js +0 -192
  88. package/dist/src/hidden.d.ts +0 -9
  89. package/dist/src/hidden.js +0 -80
  90. package/dist/src/html.d.ts +0 -61
  91. package/dist/src/html.js +0 -343
  92. package/dist/src/imageParameter.d.ts +0 -60
  93. package/dist/src/imageParameter.js +0 -260
  94. package/dist/src/imagemap.d.ts +0 -47
  95. package/dist/src/imagemap.js +0 -146
  96. package/dist/src/imagemapLink.d.ts +0 -31
  97. package/dist/src/imagemapLink.js +0 -97
  98. package/dist/src/index.d.ts +0 -136
  99. package/dist/src/index.js +0 -834
  100. package/dist/src/link/base.d.ts +0 -52
  101. package/dist/src/link/base.js +0 -256
  102. package/dist/src/link/category.d.ts +0 -22
  103. package/dist/src/link/category.js +0 -34
  104. package/dist/src/link/file.d.ts +0 -102
  105. package/dist/src/link/file.js +0 -333
  106. package/dist/src/link/galleryImage.d.ts +0 -29
  107. package/dist/src/link/galleryImage.js +0 -132
  108. package/dist/src/link/index.d.ts +0 -39
  109. package/dist/src/link/index.js +0 -98
  110. package/dist/src/link/redirectTarget.d.ts +0 -27
  111. package/dist/src/link/redirectTarget.js +0 -69
  112. package/dist/src/magicLink.d.ts +0 -58
  113. package/dist/src/magicLink.js +0 -256
  114. package/dist/src/nested.d.ts +0 -40
  115. package/dist/src/nested.js +0 -106
  116. package/dist/src/nowiki/base.d.ts +0 -28
  117. package/dist/src/nowiki/base.js +0 -89
  118. package/dist/src/nowiki/comment.d.ts +0 -14
  119. package/dist/src/nowiki/comment.js +0 -121
  120. package/dist/src/nowiki/dd.d.ts +0 -8
  121. package/dist/src/nowiki/dd.js +0 -72
  122. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
  123. package/dist/src/nowiki/doubleUnderscore.js +0 -97
  124. package/dist/src/nowiki/hr.d.ts +0 -5
  125. package/dist/src/nowiki/hr.js +0 -70
  126. package/dist/src/nowiki/index.d.ts +0 -14
  127. package/dist/src/nowiki/index.js +0 -28
  128. package/dist/src/nowiki/list.d.ts +0 -5
  129. package/dist/src/nowiki/list.js +0 -65
  130. package/dist/src/nowiki/listBase.d.ts +0 -23
  131. package/dist/src/nowiki/listBase.js +0 -99
  132. package/dist/src/nowiki/noinclude.d.ts +0 -6
  133. package/dist/src/nowiki/noinclude.js +0 -75
  134. package/dist/src/nowiki/quote.d.ts +0 -14
  135. package/dist/src/nowiki/quote.js +0 -140
  136. package/dist/src/onlyinclude.d.ts +0 -13
  137. package/dist/src/onlyinclude.js +0 -58
  138. package/dist/src/paramTag/index.d.ts +0 -28
  139. package/dist/src/paramTag/index.js +0 -78
  140. package/dist/src/paramTag/inputbox.d.ts +0 -8
  141. package/dist/src/paramTag/inputbox.js +0 -22
  142. package/dist/src/parameter.d.ts +0 -60
  143. package/dist/src/parameter.js +0 -264
  144. package/dist/src/pre.d.ts +0 -28
  145. package/dist/src/pre.js +0 -60
  146. package/dist/src/redirect.d.ts +0 -30
  147. package/dist/src/redirect.js +0 -126
  148. package/dist/src/syntax.d.ts +0 -17
  149. package/dist/src/syntax.js +0 -87
  150. package/dist/src/table/base.d.ts +0 -28
  151. package/dist/src/table/base.js +0 -81
  152. package/dist/src/table/index.d.ts +0 -230
  153. package/dist/src/table/index.js +0 -506
  154. package/dist/src/table/td.d.ts +0 -72
  155. package/dist/src/table/td.js +0 -370
  156. package/dist/src/table/tr.d.ts +0 -30
  157. package/dist/src/table/tr.js +0 -59
  158. package/dist/src/table/trBase.d.ts +0 -49
  159. package/dist/src/table/trBase.js +0 -164
  160. package/dist/src/tagPair/ext.d.ts +0 -29
  161. package/dist/src/tagPair/ext.js +0 -220
  162. package/dist/src/tagPair/include.d.ts +0 -33
  163. package/dist/src/tagPair/include.js +0 -130
  164. package/dist/src/tagPair/index.d.ts +0 -23
  165. package/dist/src/tagPair/index.js +0 -128
  166. package/dist/src/transclude.d.ts +0 -159
  167. package/dist/src/transclude.js +0 -587
  168. package/dist/util/constants.js +0 -25
  169. package/dist/util/debug.js +0 -95
  170. package/dist/util/diff.js +0 -83
  171. package/dist/util/html.js +0 -143
  172. package/dist/util/lint.js +0 -32
  173. package/dist/util/string.js +0 -87
  174. package/errors/README +0 -3
  175. package/printed/README +0 -3
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
25
- }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.NoincludeToken = void 0;
38
- const constants_1 = require("../../util/constants");
39
- const hidden_1 = require("../../mixin/hidden");
40
- const base_1 = require("./base");
41
- /** `<noinclude>`和`</noinclude>`,不可进行任何更改 */
42
- let NoincludeToken = (() => {
43
- let _classDecorators = [(0, hidden_1.hiddenToken)()];
44
- let _classDescriptor;
45
- let _classExtraInitializers = [];
46
- let _classThis;
47
- let _classSuper = base_1.NowikiBaseToken;
48
- var NoincludeToken = class extends _classSuper {
49
- static { _classThis = this; }
50
- static {
51
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
53
- NoincludeToken = _classThis = _classDescriptor.value;
54
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
- __runInitializers(_classThis, _classExtraInitializers);
56
- }
57
- get type() {
58
- return 'noinclude';
59
- }
60
- /** @private */
61
- toString(skip) {
62
- return skip ? '' : super.toString();
63
- }
64
- /* NOT FOR BROWSER */
65
- setText(str) {
66
- if (/^<\/?(?:(?:no|only)include|includeonly)(?:\s[^>]*)?\/?>$/iu.test(this.innerText)) {
67
- this.constructorError('cannot change the text content');
68
- }
69
- return super.setText(str);
70
- }
71
- };
72
- return NoincludeToken = _classThis;
73
- })();
74
- exports.NoincludeToken = NoincludeToken;
75
- constants_1.classes['NoincludeToken'] = __filename;
@@ -1,14 +0,0 @@
1
- import { NowikiBaseToken } from './base';
2
- import type { LintError, AST } from '../../base';
3
- /** `''`和`'''` */
4
- export declare abstract class QuoteToken extends NowikiBaseToken {
5
- get type(): 'quote';
6
- get bold(): boolean;
7
- get italic(): boolean;
8
- get font(): {
9
- bold: boolean;
10
- italic: boolean;
11
- };
12
- /** @override */
13
- json(): AST;
14
- }
@@ -1,140 +0,0 @@
1
- "use strict";
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
25
- }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.QuoteToken = void 0;
38
- const lint_1 = require("../../util/lint");
39
- const rect_1 = require("../../lib/rect");
40
- const constants_1 = require("../../util/constants");
41
- const syntax_1 = require("../../mixin/syntax");
42
- const index_1 = require("../../index");
43
- const base_1 = require("./base");
44
- /** `''`和`'''` */
45
- let QuoteToken = (() => {
46
- let _classDecorators = [(0, syntax_1.syntax)(/^(?:'{5}|'{2,3})$/u)];
47
- let _classDescriptor;
48
- let _classExtraInitializers = [];
49
- let _classThis;
50
- let _classSuper = base_1.NowikiBaseToken;
51
- var QuoteToken = class extends _classSuper {
52
- static { _classThis = this; }
53
- static {
54
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
- QuoteToken = _classThis = _classDescriptor.value;
57
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
- __runInitializers(_classThis, _classExtraInitializers);
59
- }
60
- get type() {
61
- return 'quote';
62
- }
63
- get bold() {
64
- return this.innerText.length !== 2;
65
- }
66
- get italic() {
67
- return this.innerText.length !== 3;
68
- }
69
- /* NOT FOR BROWSER */
70
- get font() {
71
- return { bold: this.bold, italic: this.italic };
72
- }
73
- /* NOT FOR BROWSER END */
74
- /** @private */
75
- text() {
76
- const { parentNode, innerText } = this;
77
- return parentNode?.type === 'image-parameter' && parentNode.name !== 'caption' ? '' : innerText;
78
- }
79
- /** @private */
80
- lint(start = this.getAbsoluteIndex()) {
81
- const { previousSibling, nextSibling, bold } = this, message = index_1.default.msg('lonely "$1"', `'`), errors = [], rect = new rect_1.BoundingRect(this, start);
82
- let refError;
83
- /**
84
- * 获取建议
85
- * @param startIndex 起点
86
- * @param endIndex 终点
87
- * @param length 长度
88
- */
89
- const getSuggestion = (startIndex, endIndex, length) => ({
90
- desc: 'escape',
91
- range: [startIndex, endIndex],
92
- text: '&apos;'.repeat(length),
93
- });
94
- if (previousSibling?.type === 'text' && previousSibling.data.endsWith(`'`)) {
95
- refError = (0, lint_1.generateForSelf)(this, rect, 'lonely-apos', message);
96
- const { startIndex: endIndex, startLine: endLine, startCol: endCol } = refError, [, { length }] = /(?:^|[^'])('+)$/u.exec(previousSibling.data), startIndex = start - length;
97
- errors.push({
98
- ...refError,
99
- startIndex,
100
- endIndex,
101
- startCol: endCol - length,
102
- endLine,
103
- endCol,
104
- suggestions: [getSuggestion(startIndex, endIndex, length)],
105
- });
106
- }
107
- if (nextSibling?.type === 'text' && nextSibling.data.startsWith(`'`)) {
108
- refError ??= (0, lint_1.generateForSelf)(this, rect, 'lonely-apos', message);
109
- const { endIndex: startIndex, endLine: startLine, endCol: startCol } = refError, [{ length }] = /^'+/u.exec(nextSibling.data), endIndex = startIndex + length;
110
- errors.push({
111
- ...refError,
112
- startIndex,
113
- endIndex,
114
- startLine,
115
- startCol,
116
- endCol: startCol + length,
117
- suggestions: [getSuggestion(startIndex, endIndex, length)],
118
- });
119
- }
120
- if (bold && this.closest('heading-title')) {
121
- errors.push((0, lint_1.generateForSelf)(this, rect, 'bold-header', 'bold in section header', 'warning'));
122
- }
123
- return errors;
124
- }
125
- /** @override */
126
- json() {
127
- const json = super.json();
128
- Object.assign(json, { bold: this.bold, italic: this.italic });
129
- return json;
130
- }
131
- /* NOT FOR BROWSER */
132
- /** @private */
133
- toHtmlInternal() {
134
- return '';
135
- }
136
- };
137
- return QuoteToken = _classThis;
138
- })();
139
- exports.QuoteToken = QuoteToken;
140
- constants_1.classes['QuoteToken'] = __filename;
@@ -1,13 +0,0 @@
1
- import { Token } from './index';
2
- /**
3
- * 嵌入时的`<onlyinclude>`
4
- * @classdesc `{childNodes: ...AstText|Token}`
5
- */
6
- export declare class OnlyincludeToken extends Token {
7
- get type(): 'onlyinclude';
8
- /** 内部wikitext */
9
- get innerText(): string;
10
- /** @throws `RangeError` 不允许包含`</onlyinclude>` */
11
- set innerText(text: string);
12
- cloneNode(): this;
13
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OnlyincludeToken = void 0;
4
- const debug_1 = require("../util/debug");
5
- const constants_1 = require("../util/constants");
6
- const index_1 = require("../index");
7
- const index_2 = require("./index");
8
- /**
9
- * 嵌入时的`<onlyinclude>`
10
- * @classdesc `{childNodes: ...AstText|Token}`
11
- */
12
- class OnlyincludeToken extends index_2.Token {
13
- get type() {
14
- return 'onlyinclude';
15
- }
16
- /* NOT FOR BROWSER */
17
- /** 内部wikitext */
18
- get innerText() {
19
- return this.text();
20
- }
21
- /** @throws `RangeError` 不允许包含`</onlyinclude>` */
22
- set innerText(text) {
23
- if (text.includes('</onlyinclude>')) {
24
- throw new RangeError('"</onlyinclude>" is not allowed in the text!');
25
- }
26
- this.replaceChildren(...index_1.default.parse(text, true, undefined, this.getAttribute('config')).childNodes);
27
- }
28
- /* NOT FOR BROWSER END */
29
- /** @private */
30
- toString(skip) {
31
- return `<onlyinclude>${super.toString(skip)}</onlyinclude>`;
32
- }
33
- /** @private */
34
- getAttribute(key) {
35
- if (key === 'padding') {
36
- return 13;
37
- }
38
- return (key === 'plain') || super.getAttribute(key);
39
- }
40
- /** @private */
41
- print() {
42
- return super.print({
43
- pre: '<span class="wpb-ext">&lt;onlyinclude&gt;</span>',
44
- post: '<span class="wpb-ext">&lt;/onlyinclude&gt;</span>',
45
- });
46
- }
47
- /* NOT FOR BROWSER */
48
- cloneNode() {
49
- const cloned = this.cloneChildNodes();
50
- return debug_1.Shadow.run(() => {
51
- const token = new OnlyincludeToken(undefined, this.getAttribute('config'));
52
- token.append(...cloned);
53
- return token;
54
- });
55
- }
56
- }
57
- exports.OnlyincludeToken = OnlyincludeToken;
58
- constants_1.classes['OnlyincludeToken'] = __filename;
@@ -1,28 +0,0 @@
1
- import Parser from '../../index';
2
- import { Token } from '../index';
3
- import { AtomToken } from '../atom';
4
- import type { LintError } from '../../base';
5
- import type { AttributesToken, ExtToken } from '../../internal';
6
- /**
7
- * `<dynamicpagelist>`
8
- * @classdesc `{childNodes: ...AtomToken}`
9
- */
10
- export declare abstract class ParamTagToken extends Token {
11
- readonly name: string;
12
- readonly childNodes: readonly AtomToken[];
13
- abstract get firstChild(): AtomToken | undefined;
14
- abstract get lastChild(): AtomToken | undefined;
15
- abstract get nextSibling(): undefined;
16
- abstract get previousSibling(): AttributesToken;
17
- abstract get parentNode(): ExtToken | undefined;
18
- abstract get children(): AtomToken[];
19
- abstract get firstElementChild(): AtomToken | undefined;
20
- abstract get lastElementChild(): AtomToken | undefined;
21
- abstract get nextElementSibling(): undefined;
22
- abstract get previousElementSibling(): AttributesToken;
23
- abstract get parentElement(): ExtToken | undefined;
24
- get type(): 'ext-inner';
25
- /** @class */
26
- constructor(wikitext?: string, config?: Parser.Config, accum?: Token[], acceptable?: Acceptable);
27
- cloneNode(): this;
28
- }
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParamTagToken = void 0;
4
- const lint_1 = require("../../util/lint");
5
- const rect_1 = require("../../lib/rect");
6
- const debug_1 = require("../../util/debug");
7
- const constants_1 = require("../../util/constants");
8
- const singleLine_1 = require("../../mixin/singleLine");
9
- const index_1 = require("../../index");
10
- const index_2 = require("../index");
11
- const atom_1 = require("../atom");
12
- /**
13
- * `<dynamicpagelist>`
14
- * @classdesc `{childNodes: ...AtomToken}`
15
- */
16
- class ParamTagToken extends index_2.Token {
17
- /* NOT FOR BROWSER END */
18
- get type() {
19
- return 'ext-inner';
20
- }
21
- /** @class */
22
- constructor(wikitext, config = index_1.default.getConfig(), accum = [], acceptable = {}) {
23
- super(undefined, config, accum, {
24
- AtomToken: ':',
25
- });
26
- if (wikitext) {
27
- const SingleLineAtomToken = (0, singleLine_1.singleLine)(atom_1.AtomToken);
28
- this.append(...wikitext.split('\n').map(line => new SingleLineAtomToken(line, 'param-line', config, accum, {
29
- AstText: ':', ...acceptable,
30
- })));
31
- }
32
- }
33
- /** @private */
34
- toString(skip) {
35
- return super.toString(skip, '\n');
36
- }
37
- /** @private */
38
- text() {
39
- return super.text('\n');
40
- }
41
- /** @private */
42
- getGaps() {
43
- return 1;
44
- }
45
- /** @private */
46
- lint(start = this.getAbsoluteIndex()) {
47
- const rect = new rect_1.BoundingRect(this, start);
48
- return this.childNodes.filter(child => {
49
- const { childNodes } = child, i = childNodes.findIndex(({ type }) => type !== 'text'), str = (i >= 0 ? childNodes.slice(0, i).map(String).join('') : child.toString()).trim();
50
- return str && !(i >= 0 ? /^[a-z]+(?:\[\])?\s*(?:=|$)/iu : /^[a-z]+(?:\[\])?\s*=/iu).test(str);
51
- }).map(child => {
52
- const e = (0, lint_1.generateForChild)(child, rect, 'no-ignored', index_1.default.msg('invalid parameter of <$1>', this.name));
53
- e.suggestions = [
54
- {
55
- desc: 'remove',
56
- range: [e.startIndex, e.endIndex],
57
- text: '',
58
- },
59
- ];
60
- return e;
61
- });
62
- }
63
- /** @private */
64
- print() {
65
- return super.print({ sep: '\n' });
66
- }
67
- /* NOT FOR BROWSER */
68
- cloneNode() {
69
- const cloned = this.cloneChildNodes();
70
- return debug_1.Shadow.run(() => {
71
- const C = this.constructor, token = new C(undefined, this.getAttribute('config'));
72
- token.append(...cloned);
73
- return token;
74
- });
75
- }
76
- }
77
- exports.ParamTagToken = ParamTagToken;
78
- constants_1.classes['ParamTagToken'] = __filename;
@@ -1,8 +0,0 @@
1
- import Parser from '../../index';
2
- import { ParamTagToken } from './index';
3
- import type { Token } from '../index';
4
- /** `<inputbox>` */
5
- export declare abstract class InputboxToken extends ParamTagToken {
6
- /** @class */
7
- constructor(wikitext?: string, config?: Parser.Config, accum?: Token[]);
8
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InputboxToken = void 0;
4
- const constants_1 = require("../../util/constants");
5
- const braces_1 = require("../../parser/braces");
6
- const index_1 = require("../../index");
7
- const index_2 = require("./index");
8
- /** `<inputbox>` */
9
- class InputboxToken extends index_2.ParamTagToken {
10
- /** @class */
11
- constructor(wikitext, config = index_1.default.getConfig(), accum = []) {
12
- const placeholder = Symbol('InputboxToken'), { length } = accum;
13
- accum.push(placeholder);
14
- wikitext &&= (0, braces_1.parseBraces)(wikitext, config, accum);
15
- accum.splice(length, 1);
16
- super(wikitext, config, accum, {
17
- ArgToken: ':', TranscludeToken: ':',
18
- });
19
- }
20
- }
21
- exports.InputboxToken = InputboxToken;
22
- constants_1.classes['InputboxToken'] = __filename;
@@ -1,60 +0,0 @@
1
- import Parser from '../index';
2
- import { Token } from './index';
3
- import type { LintError, AST } from '../base';
4
- import type { AtomToken, SyntaxToken, TranscludeToken } from '../internal';
5
- /**
6
- * 模板或魔术字参数
7
- * @classdesc `{childNodes: [Token, Token]}`
8
- */
9
- export declare abstract class ParameterToken extends Token {
10
- readonly name: string;
11
- readonly childNodes: readonly [Token, Token];
12
- abstract get firstChild(): Token;
13
- abstract get lastChild(): Token;
14
- abstract get parentNode(): TranscludeToken | undefined;
15
- abstract get nextSibling(): this | undefined;
16
- abstract get previousSibling(): AtomToken | SyntaxToken | this;
17
- abstract get children(): [Token, Token];
18
- abstract get firstElementChild(): Token;
19
- abstract get lastElementChild(): Token;
20
- abstract get parentElement(): TranscludeToken | undefined;
21
- abstract get nextElementSibling(): this | undefined;
22
- abstract get previousElementSibling(): AtomToken | SyntaxToken | this;
23
- get type(): 'parameter';
24
- /** 是否是匿名参数 */
25
- get anon(): boolean;
26
- set anon(value: boolean);
27
- /** getValue()的getter */
28
- get value(): string;
29
- set value(value: string);
30
- /** 是否是重复参数 */
31
- get duplicated(): boolean;
32
- set duplicated(value: boolean);
33
- /**
34
- * @param key 参数名
35
- * @param value 参数值
36
- */
37
- constructor(key?: string | number, value?: string, config?: Parser.Config, accum?: Token[]);
38
- text(): string;
39
- /** @override */
40
- json(): AST;
41
- cloneNode(): this;
42
- safeReplaceWith(token: this): void;
43
- /** 获取参数值 */
44
- getValue(): string;
45
- /**
46
- * 设置参数值
47
- * @param value 参数值
48
- */
49
- setValue(value: string): void;
50
- /**
51
- * 修改参数名
52
- * @param key 新参数名
53
- * @param force 是否无视冲突命名
54
- * @throws `Error` 仅用于模板参数
55
- * @throws `RangeError` 更名造成重复参数
56
- */
57
- rename(key: string, force?: boolean): void;
58
- /** 转义 `=` */
59
- escape(): void;
60
- }