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,267 @@
|
|
|
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.ParameterToken = void 0;
|
|
38
|
+
const string_1 = require("../util/string");
|
|
39
|
+
const lint_1 = require("../util/lint");
|
|
40
|
+
const index_1 = require("../index");
|
|
41
|
+
const index_2 = require("./index");
|
|
42
|
+
/* NOT FOR BROWSER */
|
|
43
|
+
const debug_1 = require("../util/debug");
|
|
44
|
+
const constants_1 = require("../util/constants");
|
|
45
|
+
const fixed_1 = require("../mixin/fixed");
|
|
46
|
+
/* NOT FOR BROWSER END */
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
48
|
+
/https?:\/\/(?:\[[\da-f:.]+\]|[^[\]<>"\t\n\p{Zs}])[^[\]<>"\0\t\n\p{Zs}]*$/iu;
|
|
49
|
+
const linkRegex = new RegExp(`https?://${string_1.extUrlCharFirst}${string_1.extUrlChar}$`, 'iu');
|
|
50
|
+
/**
|
|
51
|
+
* 模板或魔术字参数
|
|
52
|
+
* @classdesc `{childNodes: [Token, Token]}`
|
|
53
|
+
*/
|
|
54
|
+
let ParameterToken = (() => {
|
|
55
|
+
let _classDecorators = [fixed_1.fixedToken];
|
|
56
|
+
let _classDescriptor;
|
|
57
|
+
let _classExtraInitializers = [];
|
|
58
|
+
let _classThis;
|
|
59
|
+
let _classSuper = index_2.Token;
|
|
60
|
+
var ParameterToken = class extends _classSuper {
|
|
61
|
+
static { _classThis = this; }
|
|
62
|
+
static {
|
|
63
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
64
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
65
|
+
ParameterToken = _classThis = _classDescriptor.value;
|
|
66
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
67
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68
|
+
}
|
|
69
|
+
/* NOT FOR BROWSER END */
|
|
70
|
+
get type() {
|
|
71
|
+
return 'parameter';
|
|
72
|
+
}
|
|
73
|
+
/** 是否是匿名参数 */
|
|
74
|
+
get anon() {
|
|
75
|
+
return this.firstChild.length === 0;
|
|
76
|
+
}
|
|
77
|
+
/* NOT FOR BROWSER */
|
|
78
|
+
set anon(value) {
|
|
79
|
+
if (value) {
|
|
80
|
+
throw new Error('Cannot convert named parameter to anonymous parameter!');
|
|
81
|
+
}
|
|
82
|
+
this.parentNode?.anonToNamed();
|
|
83
|
+
}
|
|
84
|
+
/** getValue()的getter */
|
|
85
|
+
get value() {
|
|
86
|
+
return this.getValue();
|
|
87
|
+
}
|
|
88
|
+
set value(value) {
|
|
89
|
+
this.setValue(value);
|
|
90
|
+
}
|
|
91
|
+
/** 是否是重复参数 */
|
|
92
|
+
get duplicated() {
|
|
93
|
+
try {
|
|
94
|
+
return Boolean(this.parentNode?.getDuplicatedArgs().some(([key]) => key === this.name));
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
set duplicated(value) {
|
|
101
|
+
if (this.duplicated && !value) {
|
|
102
|
+
this.parentNode.fixDuplication();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/* NOT FOR BROWSER END */
|
|
106
|
+
/**
|
|
107
|
+
* @param key 参数名
|
|
108
|
+
* @param value 参数值
|
|
109
|
+
*/
|
|
110
|
+
constructor(key, value, config = index_1.default.getConfig(), accum = []) {
|
|
111
|
+
super(undefined, config, accum);
|
|
112
|
+
const keyToken = new index_2.Token(typeof key === 'number' ? undefined : key, config, accum, {
|
|
113
|
+
'Stage-11': ':', '!HeadingToken': '',
|
|
114
|
+
}), token = new index_2.Token(value, config, accum);
|
|
115
|
+
keyToken.type = 'parameter-key';
|
|
116
|
+
keyToken.setAttribute('stage', 2);
|
|
117
|
+
token.type = 'parameter-value';
|
|
118
|
+
token.setAttribute('stage', 2);
|
|
119
|
+
this.append(keyToken, token);
|
|
120
|
+
/* NOT FOR BROWSER */
|
|
121
|
+
if (typeof key === 'string') {
|
|
122
|
+
this.trimName((0, string_1.removeCommentLine)(key));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** @private */
|
|
126
|
+
trimName(name, set = true) {
|
|
127
|
+
const trimmed = (typeof name === 'string' ? name : name.toString(true))
|
|
128
|
+
.replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu, '$1');
|
|
129
|
+
if (set) {
|
|
130
|
+
this.setAttribute('name', trimmed);
|
|
131
|
+
}
|
|
132
|
+
return trimmed;
|
|
133
|
+
}
|
|
134
|
+
/** @private */
|
|
135
|
+
afterBuild() {
|
|
136
|
+
if (!this.anon) {
|
|
137
|
+
const { parentNode, firstChild } = this, name = this.trimName(firstChild);
|
|
138
|
+
if (parentNode) {
|
|
139
|
+
parentNode.getArgs(name, false, false).add(this);
|
|
140
|
+
/* NOT FOR BROWSER */
|
|
141
|
+
parentNode.getAttribute('keys').add(name);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
super.afterBuild();
|
|
145
|
+
/* NOT FOR BROWSER */
|
|
146
|
+
const /** @implements */ parameterListener = ({ prevTarget }, data) => {
|
|
147
|
+
if (!this.anon) { // 匿名参数不管怎么变动还是匿名
|
|
148
|
+
const { firstChild, name } = this;
|
|
149
|
+
if (prevTarget === firstChild) {
|
|
150
|
+
const newKey = this.trimName(firstChild);
|
|
151
|
+
data.oldKey = name;
|
|
152
|
+
data.newKey = newKey;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
this.addEventListener(['remove', 'insert', 'replace', 'text'], parameterListener);
|
|
157
|
+
}
|
|
158
|
+
/** @private */
|
|
159
|
+
toString(skip) {
|
|
160
|
+
return this.anon ? this.lastChild.toString(skip) : super.toString(skip, '=');
|
|
161
|
+
}
|
|
162
|
+
text() {
|
|
163
|
+
return this.anon ? this.lastChild.text() : super.text('=');
|
|
164
|
+
}
|
|
165
|
+
/** @private */
|
|
166
|
+
getGaps() {
|
|
167
|
+
return this.anon ? 0 : 1;
|
|
168
|
+
}
|
|
169
|
+
/** @private */
|
|
170
|
+
lint(start = this.getAbsoluteIndex(), re) {
|
|
171
|
+
const errors = super.lint(start, re), { firstChild } = this, link = linkRegex.exec(firstChild.text())?.[0];
|
|
172
|
+
if (link && new URL(link).search) {
|
|
173
|
+
const e = (0, lint_1.generateForChild)(firstChild, { start }, 'unescaped', 'unescaped query string in an anonymous parameter');
|
|
174
|
+
e.startIndex = e.endIndex;
|
|
175
|
+
e.startLine = e.endLine;
|
|
176
|
+
e.startCol = e.endCol;
|
|
177
|
+
e.endIndex++;
|
|
178
|
+
e.endCol++;
|
|
179
|
+
e.fix = { range: [e.startIndex, e.endIndex], text: '{{=}}' };
|
|
180
|
+
errors.push(e);
|
|
181
|
+
}
|
|
182
|
+
return errors;
|
|
183
|
+
}
|
|
184
|
+
/** @private */
|
|
185
|
+
print() {
|
|
186
|
+
return super.print({ sep: this.anon ? '' : '=' });
|
|
187
|
+
}
|
|
188
|
+
/** @override */
|
|
189
|
+
json() {
|
|
190
|
+
const json = super.json();
|
|
191
|
+
json['anon'] = this.anon;
|
|
192
|
+
return json;
|
|
193
|
+
}
|
|
194
|
+
/* NOT FOR BROWSER */
|
|
195
|
+
cloneNode() {
|
|
196
|
+
const [key, value] = this.cloneChildNodes(), config = this.getAttribute('config');
|
|
197
|
+
return debug_1.Shadow.run(() => {
|
|
198
|
+
// @ts-expect-error abstract class
|
|
199
|
+
const token = new ParameterToken(this.anon ? Number(this.name) : undefined, undefined, config);
|
|
200
|
+
token.firstChild.safeReplaceWith(key);
|
|
201
|
+
token.lastChild.safeReplaceWith(value);
|
|
202
|
+
if (this.anon) {
|
|
203
|
+
token.setAttribute('name', this.name);
|
|
204
|
+
}
|
|
205
|
+
return token;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
safeReplaceWith(token) {
|
|
209
|
+
index_1.default.warn(`${this.constructor.name}.safeReplaceWith regress to AstNode.replaceWith.`);
|
|
210
|
+
this.replaceWith(token);
|
|
211
|
+
}
|
|
212
|
+
/** 获取参数值 */
|
|
213
|
+
getValue() {
|
|
214
|
+
const value = (0, string_1.removeCommentLine)(this.lastChild.text());
|
|
215
|
+
return this.anon && this.parentNode?.isTemplate() !== false ? value : value.trim();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 设置参数值
|
|
219
|
+
* @param value 参数值
|
|
220
|
+
*/
|
|
221
|
+
setValue(value) {
|
|
222
|
+
const { childNodes } = index_1.default.parse(value, this.getAttribute('include'), undefined, this.getAttribute('config'));
|
|
223
|
+
this.lastChild.replaceChildren(...childNodes);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 修改参数名
|
|
227
|
+
* @param key 新参数名
|
|
228
|
+
* @param force 是否无视冲突命名
|
|
229
|
+
* @throws `Error` 仅用于模板参数
|
|
230
|
+
* @throws `RangeError` 更名造成重复参数
|
|
231
|
+
*/
|
|
232
|
+
rename(key, force) {
|
|
233
|
+
const { parentNode, anon } = this;
|
|
234
|
+
// 必须检测是否是TranscludeToken
|
|
235
|
+
if (parentNode?.isTemplate() === false) {
|
|
236
|
+
throw new Error('ParameterToken.rename method is only for template parameters!');
|
|
237
|
+
}
|
|
238
|
+
else if (anon) {
|
|
239
|
+
parentNode?.anonToNamed();
|
|
240
|
+
}
|
|
241
|
+
const root = index_1.default.parse(key, this.getAttribute('include'), undefined, this.getAttribute('config')), name = this.trimName(root, false);
|
|
242
|
+
if (this.name === name) {
|
|
243
|
+
index_1.default.warn('The actual parameter name is not changed', name);
|
|
244
|
+
}
|
|
245
|
+
else if (parentNode?.hasArg(name)) {
|
|
246
|
+
if (force) {
|
|
247
|
+
index_1.default.warn('Parameter renaming causes duplicated parameters', name);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
throw new RangeError(`Parameter renaming causes duplicated parameters: ${name}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
this.firstChild.replaceChildren(...root.childNodes);
|
|
254
|
+
}
|
|
255
|
+
/** 转义 `=` */
|
|
256
|
+
escape() {
|
|
257
|
+
for (const child of this.lastChild.childNodes) {
|
|
258
|
+
if (child.type === 'text') {
|
|
259
|
+
child.escape();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
return ParameterToken = _classThis;
|
|
265
|
+
})();
|
|
266
|
+
exports.ParameterToken = ParameterToken;
|
|
267
|
+
constants_1.classes['ParameterToken'] = __filename;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Parser from '../index';
|
|
2
|
+
import { Token } from './index';
|
|
3
|
+
import { NoincludeToken } from './nowiki/noinclude';
|
|
4
|
+
import type { LintError } from '../base';
|
|
5
|
+
import type { AstText, AttributesToken, ExtToken, ConverterToken } from '../internal';
|
|
6
|
+
/**
|
|
7
|
+
* `<pre>`
|
|
8
|
+
* @classdesc `{childNodes: [...AstText|NoincludeToken|ConverterToken]}`
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class PreToken extends Token {
|
|
11
|
+
readonly name: 'pre';
|
|
12
|
+
readonly childNodes: readonly (AstText | NoincludeToken | ConverterToken)[];
|
|
13
|
+
abstract get firstChild(): AstText | NoincludeToken | ConverterToken | undefined;
|
|
14
|
+
abstract get lastChild(): AstText | NoincludeToken | ConverterToken | undefined;
|
|
15
|
+
abstract get nextSibling(): undefined;
|
|
16
|
+
abstract get previousSibling(): AttributesToken;
|
|
17
|
+
abstract get parentNode(): ExtToken | undefined;
|
|
18
|
+
abstract get children(): (NoincludeToken | ConverterToken)[];
|
|
19
|
+
abstract get firstElementChild(): NoincludeToken | ConverterToken | undefined;
|
|
20
|
+
abstract get lastElementChild(): NoincludeToken | ConverterToken | undefined;
|
|
21
|
+
abstract get previousElementSibling(): AttributesToken;
|
|
22
|
+
abstract get nextElementSibling(): undefined;
|
|
23
|
+
abstract get parentElement(): ExtToken | undefined;
|
|
24
|
+
get type(): 'ext-inner';
|
|
25
|
+
/** @class */
|
|
26
|
+
constructor(wikitext?: string, config?: Parser.Config, accum?: Token[]);
|
|
27
|
+
cloneNode(): this;
|
|
28
|
+
}
|
package/dist/src/pre.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreToken = void 0;
|
|
4
|
+
const constants_1 = require("../util/constants");
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const index_2 = require("./index");
|
|
7
|
+
const noinclude_1 = require("./nowiki/noinclude");
|
|
8
|
+
/* NOT FOR BROWSER */
|
|
9
|
+
const debug_1 = require("../util/debug");
|
|
10
|
+
/* NOT FOR BROWSER END */
|
|
11
|
+
/**
|
|
12
|
+
* `<pre>`
|
|
13
|
+
* @classdesc `{childNodes: [...AstText|NoincludeToken|ConverterToken]}`
|
|
14
|
+
*/
|
|
15
|
+
class PreToken extends index_2.Token {
|
|
16
|
+
/* NOT FOR BROWSER END */
|
|
17
|
+
get type() {
|
|
18
|
+
return 'ext-inner';
|
|
19
|
+
}
|
|
20
|
+
/** @class */
|
|
21
|
+
constructor(wikitext, config = index_1.default.getConfig(), accum = []) {
|
|
22
|
+
if (wikitext) {
|
|
23
|
+
const opening = /<nowiki>/giu, closing = /<\/nowiki>/giu, { length } = opening.source;
|
|
24
|
+
let i = opening.exec(wikitext);
|
|
25
|
+
if (i) {
|
|
26
|
+
closing.lastIndex = i.index + length;
|
|
27
|
+
}
|
|
28
|
+
let j = closing.exec(wikitext), lastIndex = 0, str = '';
|
|
29
|
+
while (i && j) {
|
|
30
|
+
// @ts-expect-error abstract class
|
|
31
|
+
new noinclude_1.NoincludeToken(i[0], config, accum);
|
|
32
|
+
// @ts-expect-error abstract class
|
|
33
|
+
new noinclude_1.NoincludeToken(j[0], config, accum);
|
|
34
|
+
str += `${wikitext.slice(lastIndex, i.index)}\0${accum.length - 1}n\x7F${wikitext.slice(i.index + length, j.index)}\0${accum.length}n\x7F`;
|
|
35
|
+
lastIndex = j.index + length + 1;
|
|
36
|
+
opening.lastIndex = lastIndex;
|
|
37
|
+
i = opening.exec(wikitext);
|
|
38
|
+
if (i) {
|
|
39
|
+
closing.lastIndex = i.index + length;
|
|
40
|
+
}
|
|
41
|
+
j = closing.exec(wikitext);
|
|
42
|
+
}
|
|
43
|
+
wikitext = str + wikitext.slice(lastIndex);
|
|
44
|
+
}
|
|
45
|
+
super(wikitext, config, accum, {
|
|
46
|
+
AstText: ':', NoincludeToken: ':', ConverterToken: ':',
|
|
47
|
+
});
|
|
48
|
+
this.setAttribute('stage', constants_1.MAX_STAGE - 1);
|
|
49
|
+
}
|
|
50
|
+
/** @private */
|
|
51
|
+
getAttribute(key) {
|
|
52
|
+
return (key === 'plain') || super.getAttribute(key);
|
|
53
|
+
}
|
|
54
|
+
/** @private */
|
|
55
|
+
lint(start = this.getAbsoluteIndex()) {
|
|
56
|
+
return super.lint(start, /<\s*\/\s*(pre)\b/giu);
|
|
57
|
+
}
|
|
58
|
+
/* NOT FOR BROWSER */
|
|
59
|
+
cloneNode() {
|
|
60
|
+
const cloned = this.cloneChildNodes();
|
|
61
|
+
return debug_1.Shadow.run(() => {
|
|
62
|
+
// @ts-expect-error abstract class
|
|
63
|
+
const token = new PreToken(undefined, this.getAttribute('config'));
|
|
64
|
+
token.append(...cloned);
|
|
65
|
+
return token;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.PreToken = PreToken;
|
|
70
|
+
constants_1.classes['PreToken'] = __filename;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Parser from '../index';
|
|
2
|
+
import { Token } from './index';
|
|
3
|
+
import { SyntaxToken } from './syntax';
|
|
4
|
+
import { RedirectTargetToken } from './link/redirectTarget';
|
|
5
|
+
import type { LintError } from '../base';
|
|
6
|
+
/**
|
|
7
|
+
* 重定向
|
|
8
|
+
* @classdesc `{childNodes: [SyntaxToken, LinkToken]}`
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class RedirectToken extends Token {
|
|
11
|
+
#private;
|
|
12
|
+
readonly childNodes: readonly [SyntaxToken, RedirectTargetToken];
|
|
13
|
+
abstract get firstChild(): SyntaxToken;
|
|
14
|
+
abstract get lastChild(): RedirectTargetToken;
|
|
15
|
+
abstract get previousSibling(): undefined;
|
|
16
|
+
abstract get children(): [SyntaxToken, RedirectTargetToken];
|
|
17
|
+
abstract get firstElementChild(): SyntaxToken;
|
|
18
|
+
abstract get lastElementChild(): RedirectTargetToken;
|
|
19
|
+
abstract get previousElementSibling(): undefined;
|
|
20
|
+
get type(): 'redirect';
|
|
21
|
+
/**
|
|
22
|
+
* @param pre leading whitespace
|
|
23
|
+
* @param syntax 重定向魔术字
|
|
24
|
+
* @param link 重定向目标
|
|
25
|
+
* @param text 重定向显示文本(无效)
|
|
26
|
+
* @param post trailing whitespace
|
|
27
|
+
*/
|
|
28
|
+
constructor(pre: string, syntax: string | undefined, link: string, text: string | undefined, post: string, config?: Parser.Config, accum?: Token[]);
|
|
29
|
+
cloneNode(): this;
|
|
30
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
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.RedirectToken = void 0;
|
|
38
|
+
const hidden_1 = require("../mixin/hidden");
|
|
39
|
+
const index_1 = require("../index");
|
|
40
|
+
const index_2 = require("./index");
|
|
41
|
+
const syntax_1 = require("./syntax");
|
|
42
|
+
const redirectTarget_1 = require("./link/redirectTarget");
|
|
43
|
+
/* NOT FOR BROWSER */
|
|
44
|
+
const constants_1 = require("../util/constants");
|
|
45
|
+
const debug_1 = require("../util/debug");
|
|
46
|
+
const fixed_1 = require("../mixin/fixed");
|
|
47
|
+
/* NOT FOR BROWSER END */
|
|
48
|
+
/**
|
|
49
|
+
* 重定向
|
|
50
|
+
* @classdesc `{childNodes: [SyntaxToken, LinkToken]}`
|
|
51
|
+
*/
|
|
52
|
+
let RedirectToken = (() => {
|
|
53
|
+
let _classDecorators = [fixed_1.fixedToken, (0, hidden_1.hiddenToken)(false, false)];
|
|
54
|
+
let _classDescriptor;
|
|
55
|
+
let _classExtraInitializers = [];
|
|
56
|
+
let _classThis;
|
|
57
|
+
let _classSuper = index_2.Token;
|
|
58
|
+
var RedirectToken = class extends _classSuper {
|
|
59
|
+
static { _classThis = this; }
|
|
60
|
+
static {
|
|
61
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
62
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
63
|
+
RedirectToken = _classThis = _classDescriptor.value;
|
|
64
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
65
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
66
|
+
}
|
|
67
|
+
#pre;
|
|
68
|
+
#post;
|
|
69
|
+
/* NOT FOR BROWSER END */
|
|
70
|
+
get type() {
|
|
71
|
+
return 'redirect';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @param pre leading whitespace
|
|
75
|
+
* @param syntax 重定向魔术字
|
|
76
|
+
* @param link 重定向目标
|
|
77
|
+
* @param text 重定向显示文本(无效)
|
|
78
|
+
* @param post trailing whitespace
|
|
79
|
+
*/
|
|
80
|
+
constructor(pre, syntax, link, text, post, config = index_1.default.getConfig(), accum = []) {
|
|
81
|
+
super(undefined, config, accum);
|
|
82
|
+
this.#pre = pre;
|
|
83
|
+
this.#post = post;
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
85
|
+
/^(?:#redirect|#重定向)\s*(?::\s*)?$/iu;
|
|
86
|
+
const pattern = new RegExp(String.raw `^(?:${config.redirection.join('|')})\s*(?::\s*)?$`, 'iu');
|
|
87
|
+
this.append(new syntax_1.SyntaxToken(syntax, pattern, 'redirect-syntax', config, accum, {
|
|
88
|
+
AstText: ':',
|
|
89
|
+
}),
|
|
90
|
+
// @ts-expect-error abstract class
|
|
91
|
+
new redirectTarget_1.RedirectTargetToken(link, text?.slice(1), config, accum));
|
|
92
|
+
}
|
|
93
|
+
/** @private */
|
|
94
|
+
getAttribute(key) {
|
|
95
|
+
return key === 'padding' ? this.#pre.length : super.getAttribute(key);
|
|
96
|
+
}
|
|
97
|
+
/** @private */
|
|
98
|
+
toString(skip) {
|
|
99
|
+
return this.#pre + super.toString(skip) + this.#post;
|
|
100
|
+
}
|
|
101
|
+
/** @private */
|
|
102
|
+
lint(start = this.getAbsoluteIndex()) {
|
|
103
|
+
return this.lastChild.lint(start + this.#pre.length + this.firstChild.toString().length);
|
|
104
|
+
}
|
|
105
|
+
/** @private */
|
|
106
|
+
print() {
|
|
107
|
+
return super.print({ pre: this.#pre, post: this.#post });
|
|
108
|
+
}
|
|
109
|
+
/* NOT FOR BROWSER */
|
|
110
|
+
cloneNode() {
|
|
111
|
+
const cloned = this.cloneChildNodes(), config = this.getAttribute('config');
|
|
112
|
+
return debug_1.Shadow.run(() => {
|
|
113
|
+
// @ts-expect-error abstract class
|
|
114
|
+
const token = new RedirectToken([this.#pre, undefined, '', undefined, this.#post], config, []);
|
|
115
|
+
token.firstChild.safeReplaceWith(cloned[0]);
|
|
116
|
+
token.lastChild.safeReplaceWith(cloned[1]);
|
|
117
|
+
return token;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** @private */
|
|
121
|
+
toHtmlInternal() {
|
|
122
|
+
return `<ul class="redirectText"><li>${this.lastChild.toHtmlInternal()}</li></ul>`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return RedirectToken = _classThis;
|
|
126
|
+
})();
|
|
127
|
+
exports.RedirectToken = RedirectToken;
|
|
128
|
+
constants_1.classes['RedirectToken'] = __filename;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Token } from './index';
|
|
2
|
+
import type { Config, LintError } from '../base';
|
|
3
|
+
import type { SyntaxBase } from '../mixin/syntax';
|
|
4
|
+
export interface SyntaxToken extends SyntaxBase {
|
|
5
|
+
}
|
|
6
|
+
declare type SyntaxTypes = 'heading-trail' | 'magic-word-name' | 'table-syntax' | 'redirect-syntax';
|
|
7
|
+
/** 满足特定语法格式的plain Token */
|
|
8
|
+
export declare class SyntaxToken extends Token {
|
|
9
|
+
#private;
|
|
10
|
+
get type(): SyntaxTypes;
|
|
11
|
+
/** @param pattern 语法正则 */
|
|
12
|
+
constructor(wikitext: string | undefined, pattern: RegExp, type: SyntaxTypes, config?: Config, accum?: Token[], acceptable?: Acceptable);
|
|
13
|
+
cloneNode(): this;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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.SyntaxToken = void 0;
|
|
38
|
+
const index_1 = require("./index");
|
|
39
|
+
/* NOT FOR BROWSER */
|
|
40
|
+
const debug_1 = require("../util/debug");
|
|
41
|
+
const constants_1 = require("../util/constants");
|
|
42
|
+
const syntax_1 = require("../mixin/syntax");
|
|
43
|
+
/** 满足特定语法格式的plain Token */
|
|
44
|
+
let SyntaxToken = (() => {
|
|
45
|
+
let _classDecorators = [(0, syntax_1.syntax)()];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
let _classSuper = index_1.Token;
|
|
50
|
+
var SyntaxToken = class extends _classSuper {
|
|
51
|
+
static { _classThis = this; }
|
|
52
|
+
static {
|
|
53
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
54
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
55
|
+
SyntaxToken = _classThis = _classDescriptor.value;
|
|
56
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
57
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
58
|
+
}
|
|
59
|
+
#type;
|
|
60
|
+
get type() {
|
|
61
|
+
return this.#type;
|
|
62
|
+
}
|
|
63
|
+
/** @param pattern 语法正则 */
|
|
64
|
+
constructor(wikitext, pattern, type, config, accum, acceptable) {
|
|
65
|
+
super(wikitext, config, accum, acceptable);
|
|
66
|
+
this.#type = type;
|
|
67
|
+
/* NOT FOR BROWSER */
|
|
68
|
+
this.setAttribute('pattern', pattern);
|
|
69
|
+
}
|
|
70
|
+
/** @private */
|
|
71
|
+
lint(start = this.getAbsoluteIndex()) {
|
|
72
|
+
return super.lint(start, false);
|
|
73
|
+
}
|
|
74
|
+
/* NOT FOR BROWSER */
|
|
75
|
+
cloneNode() {
|
|
76
|
+
const cloned = this.cloneChildNodes(), config = this.getAttribute('config'), acceptable = this.getAcceptable();
|
|
77
|
+
return debug_1.Shadow.run(() => {
|
|
78
|
+
const token = new SyntaxToken(undefined, this.pattern, this.type, config, [], acceptable);
|
|
79
|
+
token.append(...cloned);
|
|
80
|
+
return token;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return SyntaxToken = _classThis;
|
|
85
|
+
})();
|
|
86
|
+
exports.SyntaxToken = SyntaxToken;
|
|
87
|
+
constants_1.classes['SyntaxToken'] = __filename;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Parser from '../../index';
|
|
2
|
+
import { Token } from '../index';
|
|
3
|
+
import { SyntaxToken } from '../syntax';
|
|
4
|
+
import { AttributesToken } from '../attributes';
|
|
5
|
+
import type { AttributesParentBase } from '../../mixin/attributesParent';
|
|
6
|
+
declare type TableTypes = 'table' | 'tr' | 'td';
|
|
7
|
+
export interface TableBaseToken extends AttributesParentBase {
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class TableBaseToken extends Token {
|
|
10
|
+
abstract get type(): TableTypes;
|
|
11
|
+
readonly childNodes: readonly [SyntaxToken, AttributesToken, ...Token[]];
|
|
12
|
+
abstract get firstChild(): SyntaxToken;
|
|
13
|
+
abstract get lastChild(): Token;
|
|
14
|
+
abstract get children(): [SyntaxToken, AttributesToken, ...Token[]];
|
|
15
|
+
abstract get firstElementChild(): SyntaxToken;
|
|
16
|
+
abstract get lastElementChild(): Token;
|
|
17
|
+
/**
|
|
18
|
+
* @param pattern 表格语法正则
|
|
19
|
+
* @param syntax 表格语法
|
|
20
|
+
* @param type 节点类型
|
|
21
|
+
* @param attr 表格属性
|
|
22
|
+
*/
|
|
23
|
+
constructor(pattern: RegExp, syntax: string, type: TableTypes, attr?: string, config?: Parser.Config, accum?: Token[], acceptable?: Acceptable);
|
|
24
|
+
cloneNode(): this;
|
|
25
|
+
/** 转义表格语法 */
|
|
26
|
+
escape(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|