wikilint 2.16.4 → 2.16.6

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 (121) hide show
  1. package/dist/base.d.mts +84 -27
  2. package/dist/base.d.ts +84 -27
  3. package/dist/bin/cli.js +2 -1
  4. package/dist/index.d.ts +8 -4
  5. package/dist/index.js +55 -11
  6. package/dist/lib/element.d.ts +42 -16
  7. package/dist/lib/element.js +45 -17
  8. package/dist/lib/lsp.d.ts +64 -35
  9. package/dist/lib/lsp.js +208 -159
  10. package/dist/lib/node.d.ts +50 -18
  11. package/dist/lib/node.js +66 -27
  12. package/dist/lib/text.d.ts +8 -2
  13. package/dist/lib/text.js +10 -3
  14. package/dist/lib/title.d.ts +19 -10
  15. package/dist/lib/title.js +28 -22
  16. package/dist/mixin/attributesParent.d.ts +4 -4
  17. package/dist/mixin/attributesParent.js +0 -2
  18. package/dist/mixin/hidden.d.ts +0 -2
  19. package/dist/mixin/hidden.js +0 -2
  20. package/dist/parser/braces.js +52 -20
  21. package/dist/parser/commentAndExt.js +17 -4
  22. package/dist/parser/links.js +8 -7
  23. package/dist/parser/list.js +3 -1
  24. package/dist/parser/quotes.js +2 -1
  25. package/dist/parser/redirect.js +4 -1
  26. package/dist/src/arg.d.ts +4 -2
  27. package/dist/src/arg.js +8 -4
  28. package/dist/src/atom.d.ts +5 -1
  29. package/dist/src/atom.js +5 -1
  30. package/dist/src/attribute.d.ts +9 -3
  31. package/dist/src/attribute.js +9 -3
  32. package/dist/src/attributes.d.ts +12 -4
  33. package/dist/src/attributes.js +12 -4
  34. package/dist/src/converter.d.ts +3 -1
  35. package/dist/src/converter.js +8 -5
  36. package/dist/src/converterFlags.d.ts +13 -3
  37. package/dist/src/converterFlags.js +13 -3
  38. package/dist/src/converterRule.d.ts +3 -1
  39. package/dist/src/converterRule.js +3 -1
  40. package/dist/src/extLink.d.ts +2 -0
  41. package/dist/src/extLink.js +2 -0
  42. package/dist/src/gallery.d.ts +3 -1
  43. package/dist/src/gallery.js +7 -5
  44. package/dist/src/heading.d.ts +3 -1
  45. package/dist/src/heading.js +4 -2
  46. package/dist/src/hidden.d.ts +5 -1
  47. package/dist/src/hidden.js +5 -1
  48. package/dist/src/html.d.ts +6 -2
  49. package/dist/src/html.js +6 -2
  50. package/dist/src/imageParameter.d.ts +11 -3
  51. package/dist/src/imageParameter.js +12 -4
  52. package/dist/src/imagemap.d.ts +1 -1
  53. package/dist/src/imagemap.js +5 -4
  54. package/dist/src/imagemapLink.d.ts +2 -0
  55. package/dist/src/imagemapLink.js +2 -0
  56. package/dist/src/index.d.ts +5 -3
  57. package/dist/src/index.js +28 -18
  58. package/dist/src/link/base.d.ts +4 -2
  59. package/dist/src/link/base.js +12 -6
  60. package/dist/src/link/category.d.ts +2 -0
  61. package/dist/src/link/category.js +2 -0
  62. package/dist/src/link/file.d.ts +17 -7
  63. package/dist/src/link/file.js +28 -14
  64. package/dist/src/link/galleryImage.d.ts +5 -1
  65. package/dist/src/link/galleryImage.js +9 -5
  66. package/dist/src/link/index.d.ts +2 -0
  67. package/dist/src/link/index.js +2 -0
  68. package/dist/src/link/redirectTarget.d.ts +2 -1
  69. package/dist/src/link/redirectTarget.js +4 -2
  70. package/dist/src/magicLink.d.ts +8 -4
  71. package/dist/src/magicLink.js +16 -9
  72. package/dist/src/nested.d.ts +3 -1
  73. package/dist/src/nested.js +7 -4
  74. package/dist/src/nowiki/base.d.ts +3 -1
  75. package/dist/src/nowiki/base.js +3 -1
  76. package/dist/src/nowiki/comment.d.ts +5 -1
  77. package/dist/src/nowiki/comment.js +5 -1
  78. package/dist/src/nowiki/doubleUnderscore.d.ts +5 -1
  79. package/dist/src/nowiki/doubleUnderscore.js +5 -1
  80. package/dist/src/nowiki/index.d.ts +5 -1
  81. package/dist/src/nowiki/index.js +5 -1
  82. package/dist/src/nowiki/list.d.ts +5 -1
  83. package/dist/src/nowiki/list.js +5 -1
  84. package/dist/src/nowiki/noinclude.d.ts +5 -1
  85. package/dist/src/nowiki/noinclude.js +5 -1
  86. package/dist/src/nowiki/quote.d.ts +5 -1
  87. package/dist/src/nowiki/quote.js +5 -1
  88. package/dist/src/onlyinclude.d.ts +3 -1
  89. package/dist/src/onlyinclude.js +3 -1
  90. package/dist/src/paramTag/index.d.ts +1 -1
  91. package/dist/src/paramTag/index.js +1 -1
  92. package/dist/src/parameter.d.ts +3 -1
  93. package/dist/src/parameter.js +3 -1
  94. package/dist/src/pre.d.ts +1 -1
  95. package/dist/src/pre.js +1 -1
  96. package/dist/src/redirect.d.ts +2 -0
  97. package/dist/src/redirect.js +2 -0
  98. package/dist/src/syntax.d.ts +5 -1
  99. package/dist/src/syntax.js +5 -1
  100. package/dist/src/table/base.js +3 -1
  101. package/dist/src/table/index.d.ts +20 -15
  102. package/dist/src/table/index.js +22 -23
  103. package/dist/src/table/td.d.ts +9 -3
  104. package/dist/src/table/td.js +9 -3
  105. package/dist/src/table/tr.d.ts +3 -1
  106. package/dist/src/table/tr.js +4 -2
  107. package/dist/src/table/trBase.d.ts +9 -9
  108. package/dist/src/table/trBase.js +13 -18
  109. package/dist/src/tagPair/ext.d.ts +3 -1
  110. package/dist/src/tagPair/ext.js +3 -1
  111. package/dist/src/tagPair/include.d.ts +2 -0
  112. package/dist/src/tagPair/include.js +2 -0
  113. package/dist/src/tagPair/index.d.ts +6 -2
  114. package/dist/src/tagPair/index.js +6 -2
  115. package/dist/src/transclude.d.ts +34 -10
  116. package/dist/src/transclude.js +47 -17
  117. package/dist/util/debug.js +2 -16
  118. package/dist/util/string.js +2 -0
  119. package/i18n/zh-hans.json +1 -1
  120. package/i18n/zh-hant.json +1 -1
  121. package/package.json +2 -2
package/dist/src/pre.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { AstText, AttributesToken, ExtToken, ConverterToken } from '../inte
6
6
  declare type Child = NoincludeToken | ConverterToken;
7
7
  /**
8
8
  * `<pre>`
9
- * @classdesc `{childNodes: [...AstText|NoincludeToken|ConverterToken]}`
9
+ * @classdesc `{childNodes: (AstText|NoincludeToken|ConverterToken)[]}`
10
10
  */
11
11
  export declare abstract class PreToken extends Token {
12
12
  readonly name: 'pre';
package/dist/src/pre.js CHANGED
@@ -7,7 +7,7 @@ const index_2 = require("./index");
7
7
  const noinclude_1 = require("./nowiki/noinclude");
8
8
  /**
9
9
  * `<pre>`
10
- * @classdesc `{childNodes: [...AstText|NoincludeToken|ConverterToken]}`
10
+ * @classdesc `{childNodes: (AstText|NoincludeToken|ConverterToken)[]}`
11
11
  */
12
12
  class PreToken extends index_2.Token {
13
13
  get type() {
@@ -4,6 +4,8 @@ import { SyntaxToken } from './syntax';
4
4
  import { RedirectTargetToken } from './link/redirectTarget';
5
5
  import type { LintError } from '../base';
6
6
  /**
7
+ * redirect
8
+ *
7
9
  * 重定向
8
10
  * @classdesc `{childNodes: [SyntaxToken, LinkToken]}`
9
11
  */
@@ -41,6 +41,8 @@ const index_2 = require("./index");
41
41
  const syntax_1 = require("./syntax");
42
42
  const redirectTarget_1 = require("./link/redirectTarget");
43
43
  /**
44
+ * redirect
45
+ *
44
46
  * 重定向
45
47
  * @classdesc `{childNodes: [SyntaxToken, LinkToken]}`
46
48
  */
@@ -1,7 +1,11 @@
1
1
  import { Token } from './index';
2
2
  import type { Config, LintError } from '../base';
3
3
  declare type SyntaxTypes = 'heading-trail' | 'magic-word-name' | 'table-syntax' | 'redirect-syntax';
4
- /** 满足特定语法格式的plain Token */
4
+ /**
5
+ * plain token that satisfies specific grammar syntax
6
+ *
7
+ * 满足特定语法格式的plain Token
8
+ */
5
9
  export declare class SyntaxToken extends Token {
6
10
  #private;
7
11
  get type(): SyntaxTypes;
@@ -2,7 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SyntaxToken = void 0;
4
4
  const index_1 = require("./index");
5
- /** 满足特定语法格式的plain Token */
5
+ /**
6
+ * plain token that satisfies specific grammar syntax
7
+ *
8
+ * 满足特定语法格式的plain Token
9
+ */
6
10
  class SyntaxToken extends index_1.Token {
7
11
  #type;
8
12
  get type() {
@@ -7,8 +7,10 @@ const index_2 = require("../index");
7
7
  const syntax_1 = require("../syntax");
8
8
  const attributes_1 = require("../attributes");
9
9
  /**
10
+ * table row that contains the newline at the beginning but not at the end
11
+ *
10
12
  * 表格行,含开头的换行,不含结尾的换行
11
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token]}`
13
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token[]]}`
12
14
  */
13
15
  class TableBaseToken extends (0, attributesParent_1.attributesParent)(1)(index_2.Token) {
14
16
  /**
@@ -13,14 +13,16 @@ export declare const isRowEnd: ({ type }: Token) => boolean;
13
13
  export declare class Layout extends Array<TableCoords[]> {
14
14
  }
15
15
  /**
16
+ * table
17
+ *
16
18
  * 表格
17
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken, ...TrToken, ?SyntaxToken]}`
19
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken[], ...TrToken[], ?SyntaxToken]}`
18
20
  */
19
21
  export declare abstract class TableToken extends TrBaseToken {
20
22
  readonly childNodes: readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
21
23
  abstract get lastChild(): AttributesToken | TdToken | TrToken | SyntaxToken;
22
24
  get type(): 'table';
23
- /** 表格是否闭合 */
25
+ /** whether the table is closed / 表格是否闭合 */
24
26
  get closed(): boolean;
25
27
  /**
26
28
  * @param syntax 表格语法
@@ -28,12 +30,14 @@ export declare abstract class TableToken extends TrBaseToken {
28
30
  */
29
31
  constructor(syntax: string, attr?: string, config?: Config, accum?: Token[]);
30
32
  /**
33
+ * Get the table layout
34
+ *
31
35
  * 获取表格布局
32
- * @param stop 中止条件
33
- * @param stop.row 中止行
34
- * @param stop.column 中止列
35
- * @param stop.x 中止行
36
- * @param stop.y 中止列
36
+ * @param stop stop condition / 中止条件
37
+ * @param stop.row stop at the row / 中止行
38
+ * @param stop.column stop at the column / 中止列
39
+ * @param stop.x stop at the row / 中止行
40
+ * @param stop.y stop at the column / 中止列
37
41
  */
38
42
  getLayout(stop?: {
39
43
  row?: number;
@@ -41,18 +45,19 @@ export declare abstract class TableToken extends TrBaseToken {
41
45
  x?: number;
42
46
  y?: number;
43
47
  }): Layout;
44
- /** 获取所有行 */
45
- getAllRows(): (TrToken | this)[];
46
48
  /**
47
- * 获取指定坐标的单元格
48
- * @param coords 表格坐标
49
+ * Get all rows
50
+ *
51
+ * 获取所有行
49
52
  */
50
- getNthCell(coords: TableCoords): TdToken | undefined;
53
+ getAllRows(): (TrToken | this)[];
51
54
  /**
55
+ * Get the `n`-th row
56
+ *
52
57
  * 获取第n行
53
- * @param n 行号
54
- * @param force 是否将表格自身视为第一行
55
- * @param insert 是否用于判断插入新行的位置
58
+ * @param n row number / 行号
59
+ * @param force whether to regard the table itself as the first row / 是否将表格自身视为第一行
60
+ * @param insert whether to be used to insert a new row / 是否用于判断插入新行的位置
56
61
  * @throws `RangeError` 不存在该行
57
62
  */
58
63
  getNthRow(n: number, force?: boolean, insert?: false): TrToken | this | undefined;
@@ -25,14 +25,16 @@ class Layout extends Array {
25
25
  }
26
26
  exports.Layout = Layout;
27
27
  /**
28
+ * table
29
+ *
28
30
  * 表格
29
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken, ...TrToken, ?SyntaxToken]}`
31
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken[], ...TrToken[], ?SyntaxToken]}`
30
32
  */
31
33
  class TableToken extends trBase_1.TrBaseToken {
32
34
  get type() {
33
35
  return 'table';
34
36
  }
35
- /** 表格是否闭合 */
37
+ /** whether the table is closed / 表格是否闭合 */
36
38
  get closed() {
37
39
  return this.lastChild.type === 'table-syntax';
38
40
  }
@@ -80,20 +82,24 @@ class TableToken extends trBase_1.TrBaseToken {
80
82
  }
81
83
  /** @private */
82
84
  close(syntax = '\n|}', halfParsed) {
83
- const config = this.getAttribute('config'), accum = this.getAttribute('accum'), inner = halfParsed ? [syntax] : index_1.default.parse(syntax, this.getAttribute('include'), 2, config).childNodes;
85
+ const config = this.getAttribute('config'), accum = this.getAttribute('accum'), inner = halfParsed
86
+ ? [syntax]
87
+ : index_1.default.parse(syntax, this.getAttribute('include'), 2, config).childNodes;
84
88
  debug_1.Shadow.run(() => {
85
- const token = new syntax_1.SyntaxToken(undefined, closingPattern, 'table-syntax', config, accum, {});
89
+ const token = new syntax_1.SyntaxToken(undefined, closingPattern, 'table-syntax', config, accum);
86
90
  super.insertAt(token);
87
91
  });
88
92
  this.lastChild.replaceChildren(...inner);
89
93
  }
90
94
  /**
95
+ * Get the table layout
96
+ *
91
97
  * 获取表格布局
92
- * @param stop 中止条件
93
- * @param stop.row 中止行
94
- * @param stop.column 中止列
95
- * @param stop.x 中止行
96
- * @param stop.y 中止列
98
+ * @param stop stop condition / 中止条件
99
+ * @param stop.row stop at the row / 中止行
100
+ * @param stop.column stop at the column / 中止列
101
+ * @param stop.x stop at the row / 中止行
102
+ * @param stop.y stop at the column / 中止列
97
103
  */
98
104
  getLayout(stop) {
99
105
  const rows = this.getAllRows(), { length } = rows, layout = new Layout(...emptyArray(length, () => []));
@@ -125,7 +131,11 @@ class TableToken extends trBase_1.TrBaseToken {
125
131
  }
126
132
  return layout;
127
133
  }
128
- /** 获取所有行 */
134
+ /**
135
+ * Get all rows
136
+ *
137
+ * 获取所有行
138
+ */
129
139
  getAllRows() {
130
140
  return [
131
141
  ...super.getRowCount() ? [this] : [],
@@ -133,18 +143,6 @@ class TableToken extends trBase_1.TrBaseToken {
133
143
  .filter((child) => child.type === 'tr' && child.getRowCount() > 0),
134
144
  ];
135
145
  }
136
- /**
137
- * 获取指定坐标的单元格
138
- * @param coords 表格坐标
139
- */
140
- getNthCell(
141
- // eslint-disable-next-line @stylistic/comma-dangle
142
- coords) {
143
- // eslint-disable-next-line prefer-const, @typescript-eslint/no-unnecessary-type-assertion
144
- let rawCoords = coords;
145
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
146
- return rawCoords && this.getNthRow(rawCoords.row, false, false)?.getNthCol(rawCoords.column);
147
- }
148
146
  getNthRow(n, force, insert) {
149
147
  const isRow = super.getRowCount();
150
148
  if (n === 0
@@ -156,7 +154,8 @@ class TableToken extends trBase_1.TrBaseToken {
156
154
  n--;
157
155
  }
158
156
  for (const child of this.childNodes.slice(2)) {
159
- if (child.type === 'tr' && child.getRowCount()) {
157
+ const { type } = child;
158
+ if (type === 'tr' && child.getRowCount()) {
160
159
  n--;
161
160
  if (n < 0) {
162
161
  return child;
@@ -10,7 +10,9 @@ export interface TdSpanAttrs {
10
10
  }
11
11
  declare type TdAttrGetter<T extends string> = T extends keyof TdSpanAttrs ? number : string | true | undefined;
12
12
  /**
13
- * `<td>`、`<th>`和`<caption>`
13
+ * `<td>`, `<th>` or `<caption>`
14
+ *
15
+ * `<td>`、`<th>`或`<caption>`
14
16
  * @classdesc `{childNodes: [SyntaxToken, AttributesToken, Token]}`
15
17
  */
16
18
  export declare abstract class TdToken extends TableBaseToken {
@@ -24,14 +26,18 @@ export declare abstract class TdToken extends TableBaseToken {
24
26
  get rowspan(): number;
25
27
  /** colspan */
26
28
  get colspan(): number;
27
- /** 单元格类型 */
29
+ /** cell type / 单元格类型 */
28
30
  get subtype(): TdSubtypes;
29
31
  /**
30
32
  * @param syntax 单元格语法
31
33
  * @param inner 内部wikitext
32
34
  */
33
35
  constructor(syntax: string, inner?: string, config?: Parser.Config, accum?: Token[]);
34
- /** 是否位于行首 */
36
+ /**
37
+ * Check if the cell is at the beginning of a line
38
+ *
39
+ * 是否位于行首
40
+ */
35
41
  isIndependent(): boolean;
36
42
  getAttr<T extends string>(key: T): TdAttrGetter<T>;
37
43
  }
@@ -8,7 +8,9 @@ const index_1 = require("../../index");
8
8
  const index_2 = require("../index");
9
9
  const base_1 = require("./base");
10
10
  /**
11
- * `<td>`、`<th>`和`<caption>`
11
+ * `<td>`, `<th>` or `<caption>`
12
+ *
13
+ * `<td>`、`<th>`或`<caption>`
12
14
  * @classdesc `{childNodes: [SyntaxToken, AttributesToken, Token]}`
13
15
  */
14
16
  class TdToken extends base_1.TableBaseToken {
@@ -25,7 +27,7 @@ class TdToken extends base_1.TableBaseToken {
25
27
  get colspan() {
26
28
  return this.getAttr('colspan');
27
29
  }
28
- /** 单元格类型 */
30
+ /** cell type / 单元格类型 */
29
31
  get subtype() {
30
32
  return this.#getSyntax().subtype;
31
33
  }
@@ -126,7 +128,11 @@ class TdToken extends base_1.TableBaseToken {
126
128
  }
127
129
  return errors;
128
130
  }
129
- /** 是否位于行首 */
131
+ /**
132
+ * Check if the cell is at the beginning of a line
133
+ *
134
+ * 是否位于行首
135
+ */
130
136
  isIndependent() {
131
137
  return this.firstChild.text().startsWith('\n');
132
138
  }
@@ -2,8 +2,10 @@ import { TrBaseToken } from './trBase';
2
2
  import type { Config } from '../../base';
3
3
  import type { Token, TdToken, TableToken, SyntaxToken, AttributesToken } from '../../internal';
4
4
  /**
5
+ * table row that contains the newline at the beginning but not at the end
6
+ *
5
7
  * 表格行,含开头的换行,不含结尾的换行
6
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken]}`
8
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken[]]}`
7
9
  */
8
10
  export declare abstract class TrToken extends TrBaseToken {
9
11
  readonly childNodes: readonly [SyntaxToken, AttributesToken, ...TdToken[]];
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TrToken = void 0;
4
4
  const trBase_1 = require("./trBase");
5
5
  /**
6
+ * table row that contains the newline at the beginning but not at the end
7
+ *
6
8
  * 表格行,含开头的换行,不含结尾的换行
7
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken]}`
9
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken[]]}`
8
10
  */
9
11
  class TrToken extends trBase_1.TrBaseToken {
10
12
  get type() {
@@ -15,7 +17,7 @@ class TrToken extends trBase_1.TrBaseToken {
15
17
  * @param attr 表格属性
16
18
  */
17
19
  constructor(syntax, attr, config, accum) {
18
- super(/^\n[^\S\n]*(?:\|-+|\{\{\s*!\s*\}\}-+|\{\{\s*!-\s*\}\}-*)$/u, syntax, 'tr', attr, config, accum, {});
20
+ super(/^\n[^\S\n]*(?:\|-+|\{\{\s*!\s*\}\}-+|\{\{\s*!-\s*\}\}-*)$/u, syntax, 'tr', attr, config, accum);
19
21
  }
20
22
  }
21
23
  exports.TrToken = TrToken;
@@ -1,5 +1,4 @@
1
1
  import { TableBaseToken } from './base';
2
- import { TdToken } from './td';
3
2
  import type { LintError } from '../../base';
4
3
  export interface TableCoords {
5
4
  readonly row: number;
@@ -8,16 +7,17 @@ export interface TableCoords {
8
7
  readonly y?: undefined;
9
8
  readonly start?: boolean;
10
9
  }
11
- /** 表格行或表格 */
10
+ /**
11
+ * table row or table
12
+ *
13
+ * 表格行或表格
14
+ */
12
15
  export declare abstract class TrBaseToken extends TableBaseToken {
13
16
  abstract get type(): 'table' | 'tr';
14
- /** 获取行数 */
15
- getRowCount(): number;
16
17
  /**
17
- * 获取第n列
18
- * @param n 列号
19
- * @param insert 是否用于判断插入新列的位置
20
- * @throws `RangeError` 不存在对应单元格
18
+ * Get the number of rows
19
+ *
20
+ * 获取行数
21
21
  */
22
- getNthCol(n: number, insert?: false): TdToken | undefined;
22
+ getRowCount(): number;
23
23
  }
@@ -4,7 +4,11 @@ exports.TrBaseToken = void 0;
4
4
  const lint_1 = require("../../util/lint");
5
5
  const base_1 = require("./base");
6
6
  const td_1 = require("./td");
7
- /** 表格行或表格 */
7
+ /**
8
+ * table row or table
9
+ *
10
+ * 表格行或表格
11
+ */
8
12
  class TrBaseToken extends base_1.TableBaseToken {
9
13
  /** @private */
10
14
  lint(start = this.getAbsoluteIndex(), re) {
@@ -34,24 +38,15 @@ class TrBaseToken extends base_1.TableBaseToken {
34
38
  errors.push(error);
35
39
  return errors;
36
40
  }
37
- /** 获取行数 */
41
+ /**
42
+ * Get the number of rows
43
+ *
44
+ * 获取行数
45
+ */
38
46
  getRowCount() {
39
- return Number(this.childNodes.some(child => child instanceof td_1.TdToken && child.isIndependent() && !child.firstChild.text().endsWith('+')));
40
- }
41
- getNthCol(n, insert) {
42
- let last = 0;
43
- for (const child of this.childNodes.slice(2)) {
44
- if (child instanceof td_1.TdToken) {
45
- if (child.isIndependent()) {
46
- last = Number(child.subtype !== 'caption');
47
- }
48
- n -= last;
49
- if (n < 0) {
50
- return child;
51
- }
52
- }
53
- }
54
- return undefined;
47
+ return Number(this.childNodes.some(child => child instanceof td_1.TdToken
48
+ && child.isIndependent()
49
+ && !child.firstChild.text().endsWith('+')));
55
50
  }
56
51
  }
57
52
  exports.TrBaseToken = TrBaseToken;
@@ -7,6 +7,8 @@ import type { AttributesParentBase } from '../../mixin/attributesParent';
7
7
  export interface ExtToken extends AttributesParentBase {
8
8
  }
9
9
  /**
10
+ * extension tag
11
+ *
10
12
  * 扩展标签
11
13
  * @classdesc `{childNodes: [AttributesToken, Token]}`
12
14
  */
@@ -18,10 +20,10 @@ export declare abstract class ExtToken extends TagPairToken {
18
20
  get type(): 'ext';
19
21
  /**
20
22
  * @param name 标签名
21
- * @param include 是否嵌入
22
23
  * @param attr 标签属性
23
24
  * @param inner 内部wikitext
24
25
  * @param closed 是否封闭
26
+ * @param include 是否嵌入
25
27
  */
26
28
  constructor(name: string, attr?: string, inner?: string, closed?: string, config?: Parser.Config, include?: boolean, accum?: Token[]);
27
29
  }
@@ -59,6 +59,8 @@ const del = (arr, ele) => {
59
59
  return [...set];
60
60
  };
61
61
  /**
62
+ * extension tag
63
+ *
62
64
  * 扩展标签
63
65
  * @classdesc `{childNodes: [AttributesToken, Token]}`
64
66
  */
@@ -82,10 +84,10 @@ let ExtToken = (() => {
82
84
  }
83
85
  /**
84
86
  * @param name 标签名
85
- * @param include 是否嵌入
86
87
  * @param attr 标签属性
87
88
  * @param inner 内部wikitext
88
89
  * @param closed 是否封闭
90
+ * @param include 是否嵌入
89
91
  */
90
92
  constructor(name, attr, inner, closed, config = index_1.default.getConfig(), include = false, accum = []) {
91
93
  const lcName = name.toLowerCase(),
@@ -2,6 +2,8 @@ import { TagPairToken } from './index';
2
2
  import type { LintError, Config } from '../../base';
3
3
  import type { AstText, Token } from '../../internal';
4
4
  /**
5
+ * `<includeonly>`, `<noinclude>` or `<onlyinclude>`
6
+ *
5
7
  * `<includeonly>`或`<noinclude>`或`<onlyinclude>`
6
8
  * @classdesc `{childNodes: [AstText, AstText]}`
7
9
  */
@@ -41,6 +41,8 @@ const hidden_1 = require("../../mixin/hidden");
41
41
  const index_1 = require("../../index");
42
42
  const index_2 = require("./index");
43
43
  /**
44
+ * `<includeonly>`, `<noinclude>` or `<onlyinclude>`
45
+ *
44
46
  * `<includeonly>`或`<noinclude>`或`<onlyinclude>`
45
47
  * @classdesc `{childNodes: [AstText, AstText]}`
46
48
  */
@@ -1,7 +1,11 @@
1
1
  import { Token } from '../index';
2
2
  import type { Config } from '../../base';
3
3
  import type { AstNodes } from '../../lib/node';
4
- /** 成对标签 */
4
+ /**
5
+ * Paired tags
6
+ *
7
+ * 成对标签
8
+ */
5
9
  export declare abstract class TagPairToken extends Token {
6
10
  #private;
7
11
  readonly name: string;
@@ -11,7 +15,7 @@ export declare abstract class TagPairToken extends Token {
11
15
  readonly childNodes: readonly [AstNodes, AstNodes];
12
16
  abstract get firstChild(): AstNodes;
13
17
  abstract get lastChild(): AstNodes;
14
- /** 内部wikitext */
18
+ /** inner wikitext / 内部wikitext */
15
19
  get innerText(): string | undefined;
16
20
  /**
17
21
  * @param name 标签名
@@ -2,12 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TagPairToken = void 0;
4
4
  const index_1 = require("../index");
5
- /** 成对标签 */
5
+ /**
6
+ * Paired tags
7
+ *
8
+ * 成对标签
9
+ */
6
10
  class TagPairToken extends index_1.Token {
7
11
  #tags;
8
12
  closed;
9
13
  selfClosing;
10
- /** 内部wikitext */
14
+ /** inner wikitext / 内部wikitext */
11
15
  get innerText() {
12
16
  return this.selfClosing ? undefined : this.lastChild.text();
13
17
  }
@@ -6,8 +6,10 @@ import { SyntaxToken } from './syntax';
6
6
  import type { LintError } from '../base';
7
7
  declare type Child = AtomToken | SyntaxToken;
8
8
  /**
9
+ * template or magic word
10
+ *
9
11
  * 模板或魔术字
10
- * @classdesc `{childNodes: [AtomToken|SyntaxToken, ...AtomToken, ...ParameterToken]}`
12
+ * @classdesc `{childNodes: [AtomToken|SyntaxToken, ...AtomToken[], ...ParameterToken[]]}`
11
13
  */
12
14
  export declare abstract class TranscludeToken extends Token {
13
15
  #private;
@@ -24,39 +26,61 @@ export declare abstract class TranscludeToken extends Token {
24
26
  */
25
27
  constructor(title: string, parts: ([string] | [string | number, string])[], config?: Parser.Config, accum?: Token[]);
26
28
  /**
29
+ * Set the transclusion modifier
30
+ *
27
31
  * 设置引用修饰符
28
- * @param modifier 引用修饰符
32
+ * @param modifier transclusion modifier / 引用修饰符
29
33
  */
30
34
  setModifier(modifier: string): boolean;
31
- /** 是否是模板或模块 */
35
+ /**
36
+ * Check if it is a template or a module
37
+ *
38
+ * 是否是模板或模块
39
+ */
32
40
  isTemplate(): boolean;
33
41
  /**
42
+ * Get the module name and module function name
43
+ *
34
44
  * 获取模块名和模块函数名
35
45
  * @throws `Error` 仅用于模块
36
46
  */
37
47
  getModule(): [string, string | undefined];
38
48
  /**
39
49
  * @override
40
- * @param token 待插入的子节点
41
- * @param i 插入位置
50
+ * @param token node to be inserted / 待插入的子节点
51
+ * @param i position to be inserted at / 插入位置
42
52
  */
43
53
  insertAt<T extends ParameterToken>(token: T, i?: number): T;
44
- /** 获取所有参数 */
54
+ /**
55
+ * Get all parameters
56
+ *
57
+ * 获取所有参数
58
+ */
45
59
  getAllArgs(): ParameterToken[];
46
- /** 获取所有匿名参数 */
60
+ /**
61
+ * Get all anonymous parameters
62
+ *
63
+ * 获取所有匿名参数
64
+ */
47
65
  getAnonArgs(): ParameterToken[];
48
66
  /**
67
+ * Get parameters with the specified name
68
+ *
49
69
  * 获取指定参数
50
- * @param key 参数名
51
- * @param exact 是否匹配匿名性
52
- * @param copy 是否返回一个备份
70
+ * @param key parameter name / 参数名
71
+ * @param exact whether to match anonymosity / 是否匹配匿名性
72
+ * @param copy whether to return a copy / 是否返回一个备份
53
73
  */
54
74
  getArgs(key: string | number, exact?: boolean, copy?: boolean): Set<ParameterToken>;
55
75
  /**
76
+ * Get duplicated parameters
77
+ *
56
78
  * 获取重名参数
57
79
  */
58
80
  getDuplicatedArgs(): [string, ParameterToken[]][];
59
81
  /**
82
+ * Get possible values of some magic words
83
+ *
60
84
  * 对特定魔术字获取可能的取值
61
85
  * @throws `Error` 不是可接受的魔术字
62
86
  */