wikiparser-node 1.3.4-b → 1.3.4

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 (154) hide show
  1. package/config/.schema.json +172 -0
  2. package/config/llwiki.json +35 -1
  3. package/config/moegirl.json +44 -1
  4. package/config/zhwiki.json +466 -1
  5. package/dist/addon/table.d.ts +6 -0
  6. package/dist/addon/table.js +564 -0
  7. package/dist/base.d.ts +45 -0
  8. package/dist/bin/toc.js +18 -0
  9. package/dist/index.d.ts +31 -0
  10. package/dist/index.js +209 -0
  11. package/dist/internal.d.ts +44 -0
  12. package/dist/lib/element.d.ts +155 -0
  13. package/dist/lib/element.js +634 -0
  14. package/dist/lib/node.d.ts +146 -0
  15. package/dist/lib/node.js +419 -0
  16. package/dist/lib/range.d.ts +104 -0
  17. package/dist/lib/range.js +385 -0
  18. package/dist/lib/ranges.d.ts +26 -0
  19. package/dist/lib/ranges.js +117 -0
  20. package/dist/lib/text.d.ts +62 -0
  21. package/dist/lib/text.js +248 -0
  22. package/dist/lib/title.d.ts +38 -0
  23. package/dist/lib/title.js +162 -0
  24. package/dist/mixin/attributesParent.js +94 -0
  25. package/dist/mixin/fixed.js +32 -0
  26. package/dist/mixin/flagsParent.js +70 -0
  27. package/dist/mixin/hidden.js +26 -0
  28. package/dist/mixin/magicLinkParent.js +41 -0
  29. package/dist/mixin/singleLine.js +25 -0
  30. package/dist/mixin/sol.js +43 -0
  31. package/dist/mixin/syntax.js +56 -0
  32. package/dist/parser/braces.js +121 -0
  33. package/dist/parser/commentAndExt.js +69 -0
  34. package/dist/parser/converter.js +40 -0
  35. package/dist/parser/externalLinks.js +28 -0
  36. package/dist/parser/hrAndDoubleUnderscore.js +38 -0
  37. package/dist/parser/html.js +36 -0
  38. package/dist/parser/links.js +94 -0
  39. package/dist/parser/list.js +59 -0
  40. package/dist/parser/magicLinks.js +40 -0
  41. package/dist/parser/quotes.js +67 -0
  42. package/dist/parser/selector.js +162 -0
  43. package/dist/parser/table.js +112 -0
  44. package/dist/src/arg.d.ts +58 -0
  45. package/dist/src/arg.js +189 -0
  46. package/dist/src/atom.d.ts +12 -0
  47. package/dist/src/atom.js +27 -0
  48. package/dist/src/attribute.d.ts +87 -0
  49. package/dist/src/attribute.js +392 -0
  50. package/dist/src/attributes.d.ts +107 -0
  51. package/dist/src/attributes.js +341 -0
  52. package/dist/src/converter.d.ts +52 -0
  53. package/dist/src/converter.js +79 -0
  54. package/dist/src/converterFlags.d.ts +87 -0
  55. package/dist/src/converterFlags.js +224 -0
  56. package/dist/src/converterRule.d.ts +81 -0
  57. package/dist/src/converterRule.js +212 -0
  58. package/dist/src/extLink.d.ts +54 -0
  59. package/dist/src/extLink.js +122 -0
  60. package/dist/src/gallery.d.ts +55 -0
  61. package/dist/src/gallery.js +122 -0
  62. package/dist/src/heading.d.ts +74 -0
  63. package/dist/src/heading.js +127 -0
  64. package/dist/src/hidden.d.ts +22 -0
  65. package/dist/src/hidden.js +23 -0
  66. package/dist/src/html.d.ts +101 -0
  67. package/dist/src/html.js +227 -0
  68. package/dist/src/imageParameter.d.ts +66 -0
  69. package/dist/src/imageParameter.js +247 -0
  70. package/dist/src/imagemap.d.ts +57 -0
  71. package/dist/src/imagemap.js +148 -0
  72. package/dist/src/imagemapLink.d.ts +59 -0
  73. package/dist/src/imagemapLink.js +40 -0
  74. package/dist/src/index.d.ts +146 -0
  75. package/dist/src/index.js +777 -0
  76. package/dist/src/link/base.d.ts +52 -0
  77. package/dist/src/link/base.js +209 -0
  78. package/dist/src/link/category.d.ts +13 -0
  79. package/dist/src/link/category.js +29 -0
  80. package/dist/src/link/file.d.ts +96 -0
  81. package/dist/src/link/file.js +255 -0
  82. package/dist/src/link/galleryImage.d.ts +44 -0
  83. package/dist/src/link/galleryImage.js +106 -0
  84. package/dist/src/link/index.d.ts +53 -0
  85. package/dist/src/link/index.js +123 -0
  86. package/dist/src/magicLink.d.ts +70 -0
  87. package/dist/src/magicLink.js +147 -0
  88. package/dist/src/nested.d.ts +44 -0
  89. package/dist/src/nested.js +87 -0
  90. package/dist/src/nowiki/base.d.ts +47 -0
  91. package/dist/src/nowiki/base.js +42 -0
  92. package/dist/src/nowiki/comment.d.ts +40 -0
  93. package/dist/src/nowiki/comment.js +67 -0
  94. package/dist/src/nowiki/dd.d.ts +8 -0
  95. package/dist/src/nowiki/dd.js +25 -0
  96. package/dist/src/nowiki/doubleUnderscore.d.ts +45 -0
  97. package/dist/src/nowiki/doubleUnderscore.js +50 -0
  98. package/dist/src/nowiki/hr.d.ts +31 -0
  99. package/dist/src/nowiki/hr.js +14 -0
  100. package/dist/src/nowiki/index.d.ts +16 -0
  101. package/dist/src/nowiki/index.js +21 -0
  102. package/dist/src/nowiki/list.d.ts +30 -0
  103. package/dist/src/nowiki/list.js +48 -0
  104. package/dist/src/nowiki/listBase.d.ts +19 -0
  105. package/dist/src/nowiki/listBase.js +12 -0
  106. package/dist/src/nowiki/noinclude.d.ts +26 -0
  107. package/dist/src/nowiki/noinclude.js +25 -0
  108. package/dist/src/nowiki/quote.d.ts +23 -0
  109. package/dist/src/nowiki/quote.js +45 -0
  110. package/dist/src/onlyinclude.d.ts +16 -0
  111. package/dist/src/onlyinclude.js +57 -0
  112. package/dist/src/paramTag/index.d.ts +37 -0
  113. package/dist/src/paramTag/index.js +68 -0
  114. package/dist/src/paramTag/inputbox.d.ts +8 -0
  115. package/dist/src/paramTag/inputbox.js +23 -0
  116. package/dist/src/parameter.d.ts +85 -0
  117. package/dist/src/parameter.js +205 -0
  118. package/dist/src/pre.d.ts +28 -0
  119. package/dist/src/pre.js +51 -0
  120. package/dist/src/syntax.d.ts +28 -0
  121. package/dist/src/syntax.js +34 -0
  122. package/dist/src/table/base.d.ts +53 -0
  123. package/dist/src/table/base.js +78 -0
  124. package/dist/src/table/index.d.ts +229 -0
  125. package/dist/src/table/index.js +379 -0
  126. package/dist/src/table/td.d.ts +104 -0
  127. package/dist/src/table/td.js +261 -0
  128. package/dist/src/table/tr.d.ts +32 -0
  129. package/dist/src/table/tr.js +56 -0
  130. package/dist/src/table/trBase.d.ts +54 -0
  131. package/dist/src/table/trBase.js +159 -0
  132. package/dist/src/tagPair/ext.d.ts +56 -0
  133. package/dist/src/tagPair/ext.js +142 -0
  134. package/dist/src/tagPair/include.d.ts +53 -0
  135. package/dist/src/tagPair/include.js +63 -0
  136. package/dist/src/tagPair/index.d.ts +48 -0
  137. package/dist/src/tagPair/index.js +93 -0
  138. package/dist/src/transclude.d.ts +167 -0
  139. package/dist/src/transclude.js +698 -0
  140. package/dist/util/constants.js +108 -0
  141. package/dist/util/debug.js +64 -0
  142. package/dist/util/diff.js +72 -0
  143. package/dist/util/lint.js +46 -0
  144. package/dist/util/string.js +61 -0
  145. package/errors/README +1 -0
  146. package/package.json +12 -32
  147. package/printed/README +1 -0
  148. package/bundle/bundle.min.js +0 -36
  149. package/extensions/dist/base.js +0 -68
  150. package/extensions/dist/editor.js +0 -159
  151. package/extensions/dist/highlight.js +0 -30
  152. package/extensions/dist/lint.js +0 -48
  153. package/extensions/editor.css +0 -63
  154. package/extensions/ui.css +0 -114
@@ -0,0 +1,379 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableToken = void 0;
4
+ const lint_1 = require("../../util/lint");
5
+ const string_1 = require("../../util/string");
6
+ const debug_1 = require("../../util/debug");
7
+ const constants_1 = require("../../util/constants");
8
+ const Parser = require("../../index");
9
+ const trBase_1 = require("./trBase");
10
+ const syntax_1 = require("../syntax");
11
+ const closingPattern = /^\n[^\S\n]*(?:\|\}|\{\{\s*!\s*\}\}\}|\{\{\s*!\)\s*\}\})$/u;
12
+ /**
13
+ * 表格
14
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken, ...TrToken, ?SyntaxToken]}`
15
+ */
16
+ // @ts-expect-error not implementing all abstract methods
17
+ class TableToken extends trBase_1.TrBaseToken {
18
+ type = 'table';
19
+ /** 表格是否闭合 */
20
+ get closed() {
21
+ return this.lastChild.type === 'table-syntax';
22
+ }
23
+ /* NOT FOR BROWSER */
24
+ set closed(closed) {
25
+ if (closed && !this.closed) {
26
+ this.close(this.closest('parameter') ? '\n{{!}}}' : '\n|}');
27
+ }
28
+ }
29
+ /* NOT FOR BROWSER END */
30
+ /**
31
+ * @param syntax 表格语法
32
+ * @param attr 表格属性
33
+ */
34
+ constructor(syntax, attr, config = Parser.getConfig(), accum = []) {
35
+ super(/^(?:\{\||\{\{\{\s*!\s*\}\}|\{\{\s*\(!\s*\}\})$/u, syntax, attr, config, accum, {
36
+ Token: 2, SyntaxToken: [0, -1], AttributesToken: 1, TdToken: '2:', TrToken: '2:',
37
+ });
38
+ }
39
+ /** @override */
40
+ lint(start = this.getAbsoluteIndex()) {
41
+ const errors = super.lint(start);
42
+ if (!this.closed) {
43
+ errors.push((0, lint_1.generateForChild)(this.firstChild, { start }, Parser.msg('unclosed $1', 'table')));
44
+ }
45
+ return errors;
46
+ }
47
+ /**
48
+ * 闭合表格语法
49
+ * @param syntax 表格结尾语法
50
+ * @param halfParsed
51
+ */
52
+ close(syntax = '\n|}', halfParsed = false) {
53
+ const config = this.getAttribute('config'), accum = this.getAttribute('accum'), inner = halfParsed ? [syntax] : Parser.parse(syntax, this.getAttribute('include'), 2, config).childNodes;
54
+ if (this.lastChild.type !== 'table-syntax') {
55
+ const token = debug_1.Shadow.run(() => super.insertAt(new syntax_1.SyntaxToken(undefined, closingPattern, 'table-syntax', config, accum, {
56
+ 'Stage-1': ':', '!ExtToken': '', TranscludeToken: ':',
57
+ })));
58
+ if (!halfParsed) {
59
+ token.afterBuild();
60
+ }
61
+ }
62
+ this.lastChild.replaceChildren(...inner);
63
+ }
64
+ /* NOT FOR BROWSER */
65
+ /**
66
+ * @override
67
+ * @param token 待插入的子节点
68
+ * @param i 插入位置
69
+ * @throws `SyntaxError` 表格的闭合部分非法
70
+ */
71
+ insertAt(token, i = this.length) {
72
+ const previous = this.childNodes.at(i - 1);
73
+ if (typeof token !== 'string' && token.type === 'td' && previous?.type === 'tr') {
74
+ Parser.warn('改为将单元格插入当前行。');
75
+ return previous.insertAt(token);
76
+ }
77
+ else if (i > 0 && token instanceof syntax_1.SyntaxToken && token.getAttribute('pattern') !== closingPattern) {
78
+ throw new SyntaxError(`表格的闭合部分不符合语法:${(0, string_1.noWrap)(String(token))}`);
79
+ }
80
+ return super.insertAt(token, i);
81
+ }
82
+ /** @override */
83
+ getRowCount() {
84
+ return super.getRowCount() + this.childNodes.filter(child => child.type === 'tr' && child.getRowCount()).length;
85
+ }
86
+ /** 获取下一行 */
87
+ getNextRow() {
88
+ return this.getNthRow(super.getRowCount() ? 1 : 0, false, false);
89
+ }
90
+ /** @ignore */
91
+ getNthRow(n, force = false, insert = false) {
92
+ const nRows = this.getRowCount(), isRow = super.getRowCount();
93
+ n += n < 0 ? nRows : 0;
94
+ if (n === 0 && (isRow || force && nRows === 0)) {
95
+ return this;
96
+ }
97
+ else if (n < 0 || n > nRows || n === nRows && !insert) {
98
+ throw new RangeError(`不存在第 ${n} 行!`);
99
+ }
100
+ else if (isRow) {
101
+ n--;
102
+ }
103
+ for (const child of this.childNodes.slice(2)) {
104
+ if (child.type === 'tr' && child.getRowCount()) {
105
+ n--;
106
+ if (n < 0) {
107
+ return child;
108
+ }
109
+ }
110
+ else if (child.type === 'table-syntax') {
111
+ return child;
112
+ }
113
+ }
114
+ return undefined;
115
+ }
116
+ /** 获取所有行 */
117
+ getAllRows() {
118
+ return [
119
+ ...super.getRowCount() ? [this] : [],
120
+ ...this.childNodes.slice(1)
121
+ .filter((child) => child.type === 'tr' && child.getRowCount() > 0),
122
+ ];
123
+ }
124
+ /**
125
+ * 获取指定坐标的单元格
126
+ * @param coords 表格坐标
127
+ */
128
+ getNthCell(coords) {
129
+ require('../../addon/table');
130
+ return this.getNthCell(coords);
131
+ }
132
+ /**
133
+ * 获取表格布局
134
+ * @param stop 中止条件
135
+ * @param stop.row 中止行
136
+ * @param stop.column 中止列
137
+ * @param stop.x 中止行
138
+ * @param stop.y 中止列
139
+ */
140
+ getLayout(stop) {
141
+ require('../../addon/table');
142
+ return this.getLayout(stop);
143
+ }
144
+ /** 打印表格布局 */
145
+ printLayout() {
146
+ require('../../addon/table');
147
+ this.printLayout();
148
+ }
149
+ /**
150
+ * 转换为渲染后的表格坐标
151
+ * @param {TableCoords} coord wikitext中的表格坐标
152
+ */
153
+ toRenderedCoords(coord) {
154
+ require('../../addon/table');
155
+ return this.toRenderedCoords(coord);
156
+ }
157
+ /**
158
+ * 转换为wikitext中的表格坐标
159
+ * @param {TableRenderedCoords} coord 渲染后的表格坐标
160
+ */
161
+ toRawCoords(coord) {
162
+ require('../../addon/table');
163
+ return this.toRawCoords(coord);
164
+ }
165
+ /**
166
+ * 获取完整行
167
+ * @param y 行号
168
+ */
169
+ getFullRow(y) {
170
+ require('../../addon/table');
171
+ return this.getFullRow(y);
172
+ }
173
+ /**
174
+ * 获取完整列
175
+ * @param x 列号
176
+ */
177
+ getFullCol(x) {
178
+ require('../../addon/table');
179
+ return this.getFullCol(x);
180
+ }
181
+ /**
182
+ * 设置行格式
183
+ * @param y 行号
184
+ * @param attr 表格属性
185
+ * @param multiRow 是否对所有单元格设置,或是仅对行首单元格设置
186
+ */
187
+ formatTableRow(y, attr = {}, multiRow = false) {
188
+ require('../../addon/table');
189
+ this.formatTableRow(y, attr, multiRow);
190
+ }
191
+ /**
192
+ * 设置列格式
193
+ * @param x 列号
194
+ * @param attr 表格属性
195
+ * @param multiCol 是否对所有单元格设置,或是仅对行首单元格设置
196
+ */
197
+ formatTableCol(x, attr = {}, multiCol = false) {
198
+ require('../../addon/table');
199
+ this.formatTableCol(x, attr, multiCol);
200
+ }
201
+ /**
202
+ * 填补表格行
203
+ * @param y 行号
204
+ * @param inner 填充内容
205
+ * @param subtype 单元格类型
206
+ * @param attr 表格属性
207
+ */
208
+ fillTableRow(y, inner, subtype = 'td', attr = {}) {
209
+ require('../../addon/table');
210
+ this.fillTableRow(y, inner, subtype, attr);
211
+ }
212
+ /**
213
+ * 填补表格
214
+ * @param inner 填充内容
215
+ * @param subtype 单元格类型
216
+ * @param attr 表格属性
217
+ */
218
+ fillTable(inner, subtype = 'td', attr = {}) {
219
+ require('../../addon/table');
220
+ this.fillTable(inner, subtype, attr);
221
+ }
222
+ /**
223
+ * @override
224
+ * @param inner 单元格内部wikitext
225
+ * @param coords 单元格坐标
226
+ * @param subtype 单元格类型
227
+ * @param attr 单元格属性
228
+ * @throws `RangeError` 指定的坐标不是单元格起始点
229
+ */
230
+ insertTableCell(inner, coords, subtype = 'td', attr = {}) {
231
+ require('../../addon/table');
232
+ return this.insertTableCell(inner, coords, subtype, attr);
233
+ }
234
+ /** @private */
235
+ prependTableRow() {
236
+ require('../../addon/table');
237
+ return this.prependTableRow();
238
+ }
239
+ /**
240
+ * 插入表格行
241
+ * @param y 行号
242
+ * @param attr 表格行属性
243
+ * @param inner 内部wikitext
244
+ * @param subtype 单元格类型
245
+ * @param innerAttr 单元格属性
246
+ */
247
+ insertTableRow(y, attr = {}, inner, subtype = 'td', innerAttr = {}) {
248
+ require('../../addon/table');
249
+ return this.insertTableRow(y, attr, inner, subtype, innerAttr);
250
+ }
251
+ /**
252
+ * 插入表格列
253
+ * @param x 列号
254
+ * @param inner 内部wikitext
255
+ * @param subtype 单元格类型
256
+ * @param attr 单元格属性
257
+ * @throws `RangeError` 列号过大
258
+ */
259
+ insertTableCol(x, inner, subtype = 'td', attr = {}) {
260
+ require('../../addon/table');
261
+ this.insertTableCol(x, inner, subtype, attr);
262
+ }
263
+ /**
264
+ * 移除表格行
265
+ * @param y 行号
266
+ */
267
+ removeTableRow(y) {
268
+ require('../../addon/table');
269
+ return this.removeTableRow(y);
270
+ }
271
+ /**
272
+ * 移除表格列
273
+ * @param x 列号
274
+ */
275
+ removeTableCol(x) {
276
+ require('../../addon/table');
277
+ this.removeTableCol(x);
278
+ }
279
+ /**
280
+ * 合并单元格
281
+ * @param xlim 列范围
282
+ * @param ylim 行范围
283
+ * @throws `RangeError` 待合并区域与外侧区域有重叠
284
+ */
285
+ mergeCells(xlim, ylim) {
286
+ require('../../addon/table');
287
+ return this.mergeCells(xlim, ylim);
288
+ }
289
+ /** @private */
290
+ split(coords, dirs) {
291
+ require('../../addon/table');
292
+ this.split(coords, dirs);
293
+ }
294
+ /**
295
+ * 分裂成多行
296
+ * @param coords 单元格坐标
297
+ */
298
+ splitIntoRows(coords) {
299
+ require('../../addon/table');
300
+ this.splitIntoRows(coords);
301
+ }
302
+ /**
303
+ * 分裂成多列
304
+ * @param coords 单元格坐标
305
+ */
306
+ splitIntoCols(coords) {
307
+ require('../../addon/table');
308
+ this.splitIntoCols(coords);
309
+ }
310
+ /**
311
+ * 分裂成单元格
312
+ * @param coords 单元格坐标
313
+ */
314
+ splitIntoCells(coords) {
315
+ require('../../addon/table');
316
+ this.splitIntoCells(coords);
317
+ }
318
+ /**
319
+ * 复制一行并插入该行之前
320
+ * @param row 行号
321
+ */
322
+ replicateTableRow(row) {
323
+ require('../../addon/table');
324
+ return this.replicateTableRow(row);
325
+ }
326
+ /**
327
+ * 复制一列并插入该列之前
328
+ * @param x 列号
329
+ */
330
+ replicateTableCol(x) {
331
+ require('../../addon/table');
332
+ return this.replicateTableCol(x);
333
+ }
334
+ /** @private */
335
+ moveCol(x, reference, after) {
336
+ require('../../addon/table');
337
+ this.moveCol(x, reference, after);
338
+ }
339
+ /**
340
+ * 移动表格行
341
+ * @param y 行号
342
+ * @param before 新位置
343
+ * @throws `RangeError` 无法移动
344
+ */
345
+ moveTableRowBefore(y, before) {
346
+ require('../../addon/table');
347
+ return this.moveTableRowBefore(y, before);
348
+ }
349
+ /**
350
+ * 移动表格行
351
+ * @param y 行号
352
+ * @param after 新位置
353
+ * @throws `RangeError` 无法移动
354
+ */
355
+ moveTableRowAfter(y, after) {
356
+ require('../../addon/table');
357
+ return this.moveTableRowAfter(y, after);
358
+ }
359
+ /**
360
+ * 移动表格列
361
+ * @param x 列号
362
+ * @param before 新位置
363
+ */
364
+ moveTableColBefore(x, before) {
365
+ require('../../addon/table');
366
+ this.moveTableColBefore(x, before);
367
+ }
368
+ /**
369
+ * 移动表格列
370
+ * @param x 列号
371
+ * @param after 新位置
372
+ */
373
+ moveTableColAfter(x, after) {
374
+ require('../../addon/table');
375
+ this.moveTableColAfter(x, after);
376
+ }
377
+ }
378
+ exports.TableToken = TableToken;
379
+ constants_1.classes['TableToken'] = __filename;
@@ -0,0 +1,104 @@
1
+ import * as Parser from '../../index';
2
+ import { Token } from '../index';
3
+ import { TableBaseToken } from './base';
4
+ import type { LintError } from '../../base';
5
+ import type { SyntaxToken, AttributesToken, TrToken, TableToken } from '../../internal';
6
+ export type TdSubtypes = 'td' | 'th' | 'caption';
7
+ export interface TdSpanAttrs {
8
+ rowspan?: number;
9
+ colspan?: number;
10
+ }
11
+ declare type TdAttrGetter<T extends string> = T extends keyof TdSpanAttrs ? number : string | true | undefined;
12
+ declare type TdAttrSetter<T extends string> = T extends keyof TdSpanAttrs ? number : string | boolean;
13
+ export type TdAttrs = Record<string, string | true> & TdSpanAttrs;
14
+ declare const TdToken_base: ((abstract new (...args: any[]) => {
15
+ removeAt(): never;
16
+ insertAt(token: string, i?: number | undefined): Parser.AstText;
17
+ insertAt<T extends Parser.AstNodes>(token: T, i?: number | undefined): T;
18
+ readonly length: number;
19
+ toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
20
+ text(separator?: string | undefined): string;
21
+ lint(start?: number | undefined): Parser.LintError[];
22
+ afterBuild(): void;
23
+ getAttribute<T_1 extends string>(key: T_1): TokenAttributeGetter<T_1>;
24
+ setAttribute<T_2 extends string>(key: T_2, value: TokenAttributeSetter<T_2>): void;
25
+ addEventListener(events: string | string[], listener: AstListener): void;
26
+ replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
27
+ }) & {
28
+ readonly fixed: true;
29
+ }) & typeof TableBaseToken;
30
+ /**
31
+ * `<td>`、`<th>`和`<caption>`
32
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, Token]}`
33
+ */
34
+ export declare class TdToken extends TdToken_base {
35
+ #private;
36
+ readonly type = "td";
37
+ readonly childNodes: [SyntaxToken, AttributesToken, Token];
38
+ abstract get children(): [SyntaxToken, AttributesToken, Token];
39
+ abstract get parentNode(): TrToken | TableToken | undefined;
40
+ abstract get parentElement(): TrToken | TableToken | undefined;
41
+ abstract get nextSibling(): this | TrToken | SyntaxToken | undefined;
42
+ abstract get nextElementSibling(): this | TrToken | SyntaxToken | undefined;
43
+ abstract get previousSibling(): Token | undefined;
44
+ /** 单元格类型 */
45
+ get subtype(): TdSubtypes;
46
+ set subtype(subtype: TdSubtypes);
47
+ /** rowspan */
48
+ get rowspan(): number;
49
+ set rowspan(rowspan: number);
50
+ /** colspan */
51
+ get colspan(): number;
52
+ set colspan(colspan: number);
53
+ /** 内部wikitext */
54
+ get innerText(): string;
55
+ set innerText(text: string);
56
+ /**
57
+ * @param syntax 单元格语法
58
+ * @param inner 内部wikitext
59
+ */
60
+ constructor(syntax: string, inner?: string, config?: Parser.Config, accum?: Token[]);
61
+ /** @override */
62
+ text(): string;
63
+ /** @override */
64
+ lint(start?: number): LintError[];
65
+ /** @override */
66
+ print(): string;
67
+ /** 是否位于行首 */
68
+ isIndependent(): boolean;
69
+ /** @override */
70
+ cloneNode(): this;
71
+ /**
72
+ * @override
73
+ * @param syntax 表格语法
74
+ * @param esc 是否需要转义
75
+ */
76
+ setSyntax(syntax: string, esc?: boolean): void;
77
+ /** 改为独占一行 */
78
+ independence(): void;
79
+ /**
80
+ * @override
81
+ * @param key 属性键
82
+ */
83
+ getAttr<T extends string>(key: T): TdAttrGetter<T>;
84
+ /** @override */
85
+ getAttrs(): TdAttrs;
86
+ /**
87
+ * @override
88
+ * @param key 属性键
89
+ * @param value 属性值
90
+ */
91
+ setAttr<T extends string>(key: T, value: TdAttrSetter<T>): void;
92
+ /** @override */
93
+ escape(): void;
94
+ }
95
+ /**
96
+ * 创建新的单元格
97
+ * @param inner 内部wikitext
98
+ * @param subtype 单元格类型
99
+ * @param attr 单元格属性
100
+ * @param include 是否嵌入
101
+ * @param config
102
+ */
103
+ export declare const createTd: (inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs, include?: boolean, config?: Parser.Config) => TdToken;
104
+ export {};