wikiparser-node 1.16.4 → 1.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 (151) hide show
  1. package/README.md +1 -1
  2. package/bundle/bundle.es7.js +27 -27
  3. package/bundle/bundle.lsp.js +30 -30
  4. package/bundle/bundle.min.js +29 -29
  5. package/dist/addon/table.js +7 -4
  6. package/dist/addon/token.js +13 -7
  7. package/dist/addon/transclude.js +7 -5
  8. package/dist/base.d.mts +99 -30
  9. package/dist/base.d.ts +99 -30
  10. package/dist/index.d.ts +10 -4
  11. package/dist/index.js +59 -14
  12. package/dist/lib/attributes.js +2 -2
  13. package/dist/lib/element.d.ts +96 -42
  14. package/dist/lib/element.js +98 -45
  15. package/dist/lib/lsp.d.ts +64 -35
  16. package/dist/lib/lsp.js +208 -159
  17. package/dist/lib/node.d.ts +122 -53
  18. package/dist/lib/node.js +172 -75
  19. package/dist/lib/range.d.ts +83 -31
  20. package/dist/lib/range.js +83 -31
  21. package/dist/lib/ranges.d.ts +1 -1
  22. package/dist/lib/ranges.js +3 -2
  23. package/dist/lib/text.d.ts +40 -14
  24. package/dist/lib/text.js +47 -19
  25. package/dist/lib/title.d.ts +50 -16
  26. package/dist/lib/title.js +77 -36
  27. package/dist/mixin/attributesParent.d.ts +37 -21
  28. package/dist/mixin/attributesParent.js +0 -2
  29. package/dist/mixin/flagsParent.d.ts +38 -12
  30. package/dist/mixin/hidden.d.ts +0 -2
  31. package/dist/mixin/hidden.js +0 -2
  32. package/dist/mixin/magicLinkParent.d.ts +11 -5
  33. package/dist/mixin/singleLine.d.ts +0 -2
  34. package/dist/mixin/singleLine.js +3 -3
  35. package/dist/mixin/sol.d.ts +0 -2
  36. package/dist/mixin/sol.js +2 -3
  37. package/dist/mixin/syntax.d.ts +0 -2
  38. package/dist/mixin/syntax.js +0 -2
  39. package/dist/parser/braces.js +52 -20
  40. package/dist/parser/commentAndExt.js +19 -6
  41. package/dist/parser/links.js +13 -7
  42. package/dist/parser/list.js +3 -1
  43. package/dist/parser/quotes.js +22 -2
  44. package/dist/parser/redirect.js +4 -1
  45. package/dist/src/arg.d.ts +19 -9
  46. package/dist/src/arg.js +34 -15
  47. package/dist/src/atom.d.ts +5 -1
  48. package/dist/src/atom.js +5 -1
  49. package/dist/src/attribute.d.ts +26 -8
  50. package/dist/src/attribute.js +30 -11
  51. package/dist/src/attributes.d.ts +50 -22
  52. package/dist/src/attributes.js +54 -26
  53. package/dist/src/converter.d.ts +4 -2
  54. package/dist/src/converter.js +12 -9
  55. package/dist/src/converterFlags.d.ts +45 -15
  56. package/dist/src/converterFlags.js +45 -15
  57. package/dist/src/converterRule.d.ts +30 -11
  58. package/dist/src/converterRule.js +46 -16
  59. package/dist/src/extLink.d.ts +6 -2
  60. package/dist/src/extLink.js +14 -11
  61. package/dist/src/gallery.d.ts +13 -9
  62. package/dist/src/gallery.js +35 -21
  63. package/dist/src/heading.d.ts +13 -7
  64. package/dist/src/heading.js +21 -11
  65. package/dist/src/hidden.d.ts +5 -1
  66. package/dist/src/hidden.js +7 -3
  67. package/dist/src/html.d.ts +11 -5
  68. package/dist/src/html.js +16 -7
  69. package/dist/src/imageParameter.d.ts +23 -11
  70. package/dist/src/imageParameter.js +22 -10
  71. package/dist/src/imagemap.d.ts +4 -4
  72. package/dist/src/imagemap.js +9 -5
  73. package/dist/src/imagemapLink.d.ts +3 -1
  74. package/dist/src/imagemapLink.js +3 -1
  75. package/dist/src/index.d.ts +65 -20
  76. package/dist/src/index.js +111 -39
  77. package/dist/src/link/base.d.ts +14 -6
  78. package/dist/src/link/base.js +40 -17
  79. package/dist/src/link/category.d.ts +7 -2
  80. package/dist/src/link/category.js +20 -4
  81. package/dist/src/link/file.d.ts +71 -23
  82. package/dist/src/link/file.js +100 -36
  83. package/dist/src/link/galleryImage.d.ts +8 -4
  84. package/dist/src/link/galleryImage.js +15 -8
  85. package/dist/src/link/index.d.ts +12 -4
  86. package/dist/src/link/index.js +15 -5
  87. package/dist/src/link/redirectTarget.d.ts +3 -2
  88. package/dist/src/link/redirectTarget.js +5 -3
  89. package/dist/src/magicLink.d.ts +24 -11
  90. package/dist/src/magicLink.js +36 -19
  91. package/dist/src/nested.d.ts +5 -3
  92. package/dist/src/nested.js +9 -6
  93. package/dist/src/nowiki/base.d.ts +4 -2
  94. package/dist/src/nowiki/base.js +6 -5
  95. package/dist/src/nowiki/comment.d.ts +6 -2
  96. package/dist/src/nowiki/comment.js +8 -3
  97. package/dist/src/nowiki/dd.d.ts +0 -3
  98. package/dist/src/nowiki/dd.js +0 -8
  99. package/dist/src/nowiki/doubleUnderscore.d.ts +5 -1
  100. package/dist/src/nowiki/doubleUnderscore.js +5 -1
  101. package/dist/src/nowiki/index.d.ts +5 -1
  102. package/dist/src/nowiki/index.js +5 -1
  103. package/dist/src/nowiki/list.d.ts +5 -1
  104. package/dist/src/nowiki/list.js +5 -1
  105. package/dist/src/nowiki/listBase.d.ts +15 -5
  106. package/dist/src/nowiki/listBase.js +40 -9
  107. package/dist/src/nowiki/noinclude.d.ts +5 -1
  108. package/dist/src/nowiki/noinclude.js +5 -1
  109. package/dist/src/nowiki/quote.d.ts +15 -8
  110. package/dist/src/nowiki/quote.js +32 -12
  111. package/dist/src/onlyinclude.d.ts +4 -2
  112. package/dist/src/onlyinclude.js +4 -2
  113. package/dist/src/paramTag/index.d.ts +1 -1
  114. package/dist/src/paramTag/index.js +1 -1
  115. package/dist/src/parameter.d.ts +24 -12
  116. package/dist/src/parameter.js +45 -27
  117. package/dist/src/pre.d.ts +1 -1
  118. package/dist/src/pre.js +1 -1
  119. package/dist/src/redirect.d.ts +2 -0
  120. package/dist/src/redirect.js +2 -0
  121. package/dist/src/syntax.d.ts +5 -1
  122. package/dist/src/syntax.js +5 -1
  123. package/dist/src/table/base.d.ts +5 -1
  124. package/dist/src/table/base.js +10 -3
  125. package/dist/src/table/index.d.ts +134 -66
  126. package/dist/src/table/index.js +150 -81
  127. package/dist/src/table/td.d.ts +18 -10
  128. package/dist/src/table/td.js +25 -15
  129. package/dist/src/table/tr.d.ts +13 -3
  130. package/dist/src/table/tr.js +14 -6
  131. package/dist/src/table/trBase.d.ts +28 -12
  132. package/dist/src/table/trBase.js +28 -18
  133. package/dist/src/tagPair/ext.d.ts +3 -1
  134. package/dist/src/tagPair/ext.js +10 -8
  135. package/dist/src/tagPair/include.d.ts +8 -2
  136. package/dist/src/tagPair/include.js +8 -2
  137. package/dist/src/tagPair/index.d.ts +6 -2
  138. package/dist/src/tagPair/index.js +6 -2
  139. package/dist/src/transclude.d.ts +102 -33
  140. package/dist/src/transclude.js +114 -42
  141. package/dist/util/debug.js +2 -7
  142. package/dist/util/html.js +1 -18
  143. package/dist/util/string.js +7 -1
  144. package/extensions/dist/base.js +27 -16
  145. package/extensions/dist/codejar.js +2 -1
  146. package/extensions/dist/lsp.js +5 -10
  147. package/extensions/es7/base.js +27 -16
  148. package/extensions/ui.css +1 -162
  149. package/i18n/zh-hans.json +1 -1
  150. package/i18n/zh-hant.json +1 -1
  151. package/package.json +3 -3
@@ -18,12 +18,18 @@ export type TableTokens = TableToken | TrToken | TdToken;
18
18
  export declare const isRowEnd: ({ type }: Token) => boolean;
19
19
  /** @extends {Array<TableCoords[]>} */
20
20
  export declare class Layout extends Array<TableCoords[]> {
21
- /** 打印表格布局 */
21
+ /**
22
+ * Print the table layout
23
+ *
24
+ * 打印表格布局
25
+ */
22
26
  print(): void;
23
27
  }
24
28
  /**
29
+ * table
30
+ *
25
31
  * 表格
26
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken, ...TrToken, ?SyntaxToken]}`
32
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ?Token, ...TdToken[], ...TrToken[], ?SyntaxToken]}`
27
33
  */
28
34
  export declare abstract class TableToken extends TrBaseToken {
29
35
  readonly childNodes: readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
@@ -31,7 +37,7 @@ export declare abstract class TableToken extends TrBaseToken {
31
37
  abstract get children(): [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
32
38
  abstract get lastElementChild(): AttributesToken | TdToken | TrToken | SyntaxToken;
33
39
  get type(): 'table';
34
- /** 表格是否闭合 */
40
+ /** whether the table is closed / 表格是否闭合 */
35
41
  get closed(): boolean;
36
42
  set closed(closed: boolean);
37
43
  /**
@@ -40,18 +46,22 @@ export declare abstract class TableToken extends TrBaseToken {
40
46
  */
41
47
  constructor(syntax: string, attr?: string, config?: Config, accum?: Token[]);
42
48
  /**
49
+ * Close the table syntax
50
+ *
43
51
  * 闭合表格语法
44
- * @param syntax 表格结尾语法
52
+ * @param syntax syntax of the table end / 表格结尾语法
45
53
  * @param halfParsed
46
54
  */
47
55
  close(syntax?: string, halfParsed?: boolean): void;
48
56
  /**
57
+ * Get the table layout
58
+ *
49
59
  * 获取表格布局
50
- * @param stop 中止条件
51
- * @param stop.row 中止行
52
- * @param stop.column 中止列
53
- * @param stop.x 中止行
54
- * @param stop.y 中止列
60
+ * @param stop stop condition / 中止条件
61
+ * @param stop.row stop at the row / 中止行
62
+ * @param stop.column stop at the column / 中止列
63
+ * @param stop.x stop at the row / 中止行
64
+ * @param stop.y stop at the column / 中止列
55
65
  */
56
66
  getLayout(stop?: {
57
67
  row?: number;
@@ -59,170 +69,228 @@ export declare abstract class TableToken extends TrBaseToken {
59
69
  x?: number;
60
70
  y?: number;
61
71
  }): Layout;
62
- /** 获取所有行 */
63
- getAllRows(): (TrToken | this)[];
64
72
  /**
65
- * 获取指定坐标的单元格
66
- * @param coords 表格坐标
73
+ * Get all rows
74
+ *
75
+ * 获取所有行
67
76
  */
68
- getNthCell(coords: TableCoords | TableRenderedCoords): TdToken | undefined;
77
+ getAllRows(): (TrToken | this)[];
69
78
  /**
79
+ * Get the `n`-th row
80
+ *
70
81
  * 获取第n行
71
- * @param n 行号
72
- * @param force 是否将表格自身视为第一行
73
- * @param insert 是否用于判断插入新行的位置
82
+ * @param n row number / 行号
83
+ * @param force whether to regard the table itself as the first row / 是否将表格自身视为第一行
84
+ * @param insert whether to be used to insert a new row / 是否用于判断插入新行的位置
74
85
  * @throws `RangeError` 不存在该行
75
86
  */
76
87
  getNthRow(n: number, force?: boolean, insert?: false): TrToken | this | undefined;
77
88
  getNthRow(n: number, force: boolean, insert: true): TrToken | this | SyntaxToken | undefined;
78
- /** @override */
79
- json(): AST;
80
89
  /**
81
90
  * @override
82
- * @param token 待插入的子节点
83
- * @param i 插入位置
91
+ * @param token node to be inserted / 待插入的子节点
92
+ * @param i position to be inserted at / 插入位置
84
93
  * @throws `SyntaxError` 表格的闭合部分非法
85
94
  */
86
95
  insertAt<T extends Token>(token: T, i?: number): T;
87
96
  getRowCount(): number;
88
- /** 获取下一行 */
97
+ /**
98
+ * Get the next row
99
+ *
100
+ * 获取下一行
101
+ */
89
102
  getNextRow(): TrToken | undefined;
90
- /** 打印表格布局 */
103
+ /**
104
+ * Get the cell with the specified coordinates
105
+ *
106
+ * 获取指定坐标的单元格
107
+ * @param coords table coordinates / 表格坐标
108
+ */
109
+ getNthCell(coords: TableCoords | TableRenderedCoords): TdToken | undefined;
110
+ /**
111
+ * Print the table layout
112
+ *
113
+ * 打印表格布局
114
+ */
91
115
  printLayout(): void;
92
116
  /**
117
+ * Convert to table coordinates after rendering
118
+ *
93
119
  * 转换为渲染后的表格坐标
94
- * @param {TableCoords} coord wikitext中的表格坐标
120
+ * @param {TableCoords} coord table coordinates in wikitext / wikitext中的表格坐标
95
121
  */
96
122
  toRenderedCoords(coord: TableCoords): TableRenderedCoords | undefined;
97
123
  /**
124
+ * Convert to table coordinates in wikitext
125
+ *
98
126
  * 转换为wikitext中的表格坐标
99
- * @param {TableRenderedCoords} coord 渲染后的表格坐标
127
+ * @param {TableRenderedCoords} coord table coordinates after rendering / 渲染后的表格坐标
100
128
  */
101
129
  toRawCoords(coord: TableRenderedCoords): TableCoords | undefined;
102
130
  /**
131
+ * Get the full row
132
+ *
103
133
  * 获取完整行
104
- * @param y 行号
134
+ * @param y row number / 行号
105
135
  */
106
136
  getFullRow(y: number): Map<TdToken, boolean>;
107
137
  /**
138
+ * Get the full column
139
+ *
108
140
  * 获取完整列
109
- * @param x 列号
141
+ * @param x column number / 列号
110
142
  */
111
143
  getFullCol(x: number): Map<TdToken, boolean>;
112
144
  /**
145
+ * Format the row
146
+ *
113
147
  * 设置行格式
114
- * @param y 行号
115
- * @param attr 表格属性
116
- * @param multiRow 是否对所有单元格设置,或是仅对行首单元格设置
148
+ * @param y row number / 行号
149
+ * @param attr table attribute / 表格属性
150
+ * @param multiRow whether to format multi-row cells / 是否对所有单元格设置,或是仅对行首单元格设置
117
151
  */
118
152
  formatTableRow(y: number, attr?: TdAttrs | string, multiRow?: boolean): void;
119
153
  /**
154
+ * Format the column
155
+ *
120
156
  * 设置列格式
121
- * @param x 列号
122
- * @param attr 表格属性
123
- * @param multiCol 是否对所有单元格设置,或是仅对行首单元格设置
157
+ * @param x column number / 列号
158
+ * @param attr table attribute / 表格属性
159
+ * @param multiCol whether to format multi-column cells / 是否对所有单元格设置,或是仅对行首单元格设置
124
160
  */
125
161
  formatTableCol(x: number, attr?: TdAttrs | string, multiCol?: boolean): void;
126
162
  /**
163
+ * Fill the table row
164
+ *
127
165
  * 填补表格行
128
- * @param y 行号
129
- * @param inner 填充内容
130
- * @param subtype 单元格类型
131
- * @param attr 表格属性
166
+ * @param y row number / 行号
167
+ * @param inner content to fill / 填充内容
168
+ * @param subtype type of the cell / 单元格类型
169
+ * @param attr table attribute / 表格属性
132
170
  */
133
171
  fillTableRow(y: number, inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
134
172
  /**
173
+ * Fill the table
174
+ *
135
175
  * 填补表格
136
- * @param inner 填充内容
137
- * @param subtype 单元格类型
138
- * @param attr 表格属性
176
+ * @param inner content to fill / 填充内容
177
+ * @param subtype type of the cell / 单元格类型
178
+ * @param attr table attribute / 表格属性
139
179
  */
140
180
  fillTable(inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
141
181
  insertTableCell(inner: string | Token, coords: TableCoords | TableRenderedCoords, subtype?: TdSubtypes, attr?: TdAttrs): TdToken;
142
182
  /**
183
+ * Insert a table row
184
+ *
143
185
  * 插入表格行
144
- * @param y 行号
145
- * @param attr 表格行属性
146
- * @param inner 内部wikitext
147
- * @param subtype 单元格类型
148
- * @param innerAttr 单元格属性
186
+ * @param y row number / 行号
187
+ * @param attr table row attribute / 表格行属性
188
+ * @param inner inner wikitext / 内部wikitext
189
+ * @param subtype type of the cell / 单元格类型
190
+ * @param innerAttr cell attribute / 单元格属性
149
191
  */
150
192
  insertTableRow(y: number, attr?: Record<string, string | true>, inner?: string | Token, subtype?: TdSubtypes, innerAttr?: TdAttrs): TrToken;
151
193
  /**
194
+ * Insert a table column
195
+ *
152
196
  * 插入表格列
153
- * @param x 列号
154
- * @param inner 内部wikitext
155
- * @param subtype 单元格类型
156
- * @param attr 单元格属性
197
+ * @param x column number / 列号
198
+ * @param inner inner wikitext / 内部wikitext
199
+ * @param subtype type of the cell / 单元格类型
200
+ * @param attr cell attribute / 单元格属性
157
201
  * @throws `RangeError` 列号过大
158
202
  */
159
203
  insertTableCol(x: number, inner: string | Token, subtype?: TdSubtypes, attr?: TdAttrs): void;
160
204
  /**
205
+ * Remove a table row
206
+ *
161
207
  * 移除表格行
162
- * @param y 行号
208
+ * @param y row number / 行号
163
209
  */
164
210
  removeTableRow(y: number): TrToken;
165
211
  /**
212
+ * Remove a table column
213
+ *
166
214
  * 移除表格列
167
- * @param x 列号
215
+ * @param x column number / 列号
168
216
  */
169
217
  removeTableCol(x: number): void;
170
218
  /**
219
+ * Marge cells
220
+ *
171
221
  * 合并单元格
172
- * @param xlim 列范围
173
- * @param ylim 行范围
222
+ * @param xlim column range / 列范围
223
+ * @param ylim row range / 行范围
174
224
  * @throws `RangeError` 待合并区域与外侧区域有重叠
175
225
  */
176
226
  mergeCells(xlim: readonly [number, number], ylim: readonly [number, number]): TdToken;
177
227
  /**
228
+ * Split a cell into rows
229
+ *
178
230
  * 分裂成多行
179
- * @param coords 单元格坐标
231
+ * @param coords coordinates of the cell / 单元格坐标
180
232
  */
181
233
  splitIntoRows(coords: TableCoords | TableRenderedCoords): void;
182
234
  /**
235
+ * Split a cell into columns
236
+ *
183
237
  * 分裂成多列
184
- * @param coords 单元格坐标
238
+ * @param coords coordinates of the cell / 单元格坐标
185
239
  */
186
240
  splitIntoCols(coords: TableCoords | TableRenderedCoords): void;
187
241
  /**
242
+ * Split a cell into cells
243
+ *
188
244
  * 分裂成单元格
189
- * @param coords 单元格坐标
245
+ * @param coords coordinates of the cell / 单元格坐标
190
246
  */
191
247
  splitIntoCells(coords: TableCoords | TableRenderedCoords): void;
192
248
  /**
249
+ * Replicate a row and insert the result before the row
250
+ *
193
251
  * 复制一行并插入该行之前
194
- * @param row 行号
252
+ * @param row row number / 行号
195
253
  */
196
254
  replicateTableRow(row: number): TrToken;
197
255
  /**
256
+ * Replicate a column and insert the result before the column
257
+ *
198
258
  * 复制一列并插入该列之前
199
- * @param x 列号
259
+ * @param x column number / 列号
200
260
  */
201
261
  replicateTableCol(x: number): TdToken[];
202
262
  /**
263
+ * Move a table row
264
+ *
203
265
  * 移动表格行
204
- * @param y 行号
205
- * @param before 新位置
266
+ * @param y row number / 行号
267
+ * @param before new position / 新位置
206
268
  * @throws `RangeError` 无法移动
207
269
  */
208
270
  moveTableRowBefore(y: number, before: number): TrToken;
209
271
  /**
272
+ * Move a table row
273
+ *
210
274
  * 移动表格行
211
- * @param y 行号
212
- * @param after 新位置
275
+ * @param y row number / 行号
276
+ * @param after new position / 新位置
213
277
  * @throws `RangeError` 无法移动
214
278
  */
215
279
  moveTableRowAfter(y: number, after: number): TrToken;
216
280
  /**
281
+ * Move a table column
282
+ *
217
283
  * 移动表格列
218
- * @param x 列号
219
- * @param before 新位置
284
+ * @param x column number / 列号
285
+ * @param before new position / 新位置
220
286
  */
221
287
  moveTableColBefore(x: number, before: number): void;
222
288
  /**
289
+ * Move a table column
290
+ *
223
291
  * 移动表格列
224
- * @param x 列号
225
- * @param after 新位置
292
+ * @param x column number / 列号
293
+ * @param after new position / 新位置
226
294
  */
227
295
  moveTableColAfter(x: number, after: number): void;
228
296
  }