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
@@ -41,10 +41,14 @@ const index_1 = require("../../index");
41
41
  const base_1 = require("./base");
42
42
  /* NOT FOR BROWSER */
43
43
  const constants_1 = require("../../util/constants");
44
- const html_1 = require("../../util/html");
44
+ const debug_1 = require("../../util/debug");
45
45
  const syntax_1 = require("../../mixin/syntax");
46
46
  /* NOT FOR BROWSER END */
47
- /** `''`和`'''` */
47
+ /**
48
+ * `''` and `'''`
49
+ *
50
+ * `''`和`'''`
51
+ */
48
52
  let QuoteToken = (() => {
49
53
  let _classDecorators = [(0, syntax_1.syntax)(/^(?:'{5}|'{2,3})$/u)];
50
54
  let _classDescriptor;
@@ -60,6 +64,9 @@ let QuoteToken = (() => {
60
64
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
61
65
  __runInitializers(_classThis, _classExtraInitializers);
62
66
  }
67
+ /* NOT FOR BROWSER */
68
+ #closing;
69
+ /* NOT FOR BROWSER END */
63
70
  get type() {
64
71
  return 'quote';
65
72
  }
@@ -73,6 +80,18 @@ let QuoteToken = (() => {
73
80
  get font() {
74
81
  return { bold: this.bold, italic: this.italic };
75
82
  }
83
+ /** whether to be closing quotes / 是否闭合 */
84
+ get closing() {
85
+ return {
86
+ ...this.bold ? { bold: this.#closing.bold } : undefined,
87
+ ...this.italic ? { italic: this.#closing.italic } : undefined,
88
+ };
89
+ }
90
+ /** @param closing 是否闭合 */
91
+ constructor(wikitext, closing, config, accum) {
92
+ super(wikitext, config, accum);
93
+ this.#closing = closing;
94
+ }
76
95
  /* NOT FOR BROWSER END */
77
96
  /** @private */
78
97
  text() {
@@ -123,22 +142,23 @@ let QuoteToken = (() => {
123
142
  }
124
143
  return errors;
125
144
  }
126
- /** @override */
127
- json() {
128
- const json = super.json();
145
+ /** @private */
146
+ json(_, start = this.getAbsoluteIndex()) {
147
+ const json = super.json(undefined, start);
129
148
  Object.assign(json, { bold: this.bold, italic: this.italic });
130
149
  return json;
131
150
  }
132
151
  /* NOT FOR BROWSER */
152
+ cloneNode() {
153
+ return debug_1.Shadow.run(
154
+ // @ts-expect-error abstract class
155
+ () => new QuoteToken(this.innerText, this.#closing, this.getAttribute('config')));
156
+ }
133
157
  /** @private */
134
158
  toHtmlInternal() {
135
- const { previousVisibleSibling, nextVisibleSibling } = this;
136
- return (!previousVisibleSibling
137
- || previousVisibleSibling.type === 'text' && previousVisibleSibling.data.includes('\n'))
138
- && nextVisibleSibling?.type === 'text'
139
- && nextVisibleSibling.data.startsWith('\n')
140
- ? (0, html_1.font)(this)
141
- : '';
159
+ const { closing: { bold, italic } } = this;
160
+ return (bold ? '</b>' : '') + (italic ? '</i>' : '')
161
+ + (italic === false ? '<i>' : '') + (bold === false ? '<b>' : '');
142
162
  }
143
163
  };
144
164
  return QuoteToken = _classThis;
@@ -1,11 +1,13 @@
1
1
  import { Token } from './index';
2
2
  /**
3
+ * `<onlyinclude>` during transclusion
4
+ *
3
5
  * 嵌入时的`<onlyinclude>`
4
- * @classdesc `{childNodes: ...AstText|Token}`
6
+ * @classdesc `{childNodes: (AstText|Token)[]}`
5
7
  */
6
8
  export declare class OnlyincludeToken extends Token {
7
9
  get type(): 'onlyinclude';
8
- /** 内部wikitext */
10
+ /** inner wikitext / 内部wikitext */
9
11
  get innerText(): string;
10
12
  /** @throws `RangeError` 不允许包含`</onlyinclude>` */
11
13
  set innerText(text: string);
@@ -8,15 +8,17 @@ const constants_1 = require("../util/constants");
8
8
  const index_2 = require("../index");
9
9
  /* NOT FOR BROWSER END */
10
10
  /**
11
+ * `<onlyinclude>` during transclusion
12
+ *
11
13
  * 嵌入时的`<onlyinclude>`
12
- * @classdesc `{childNodes: ...AstText|Token}`
14
+ * @classdesc `{childNodes: (AstText|Token)[]}`
13
15
  */
14
16
  class OnlyincludeToken extends index_1.Token {
15
17
  get type() {
16
18
  return 'onlyinclude';
17
19
  }
18
20
  /* NOT FOR BROWSER */
19
- /** 内部wikitext */
21
+ /** inner wikitext / 内部wikitext */
20
22
  get innerText() {
21
23
  return this.text();
22
24
  }
@@ -5,7 +5,7 @@ import type { LintError } from '../../base';
5
5
  import type { AttributesToken, ExtToken } from '../../internal';
6
6
  /**
7
7
  * `<dynamicpagelist>`
8
- * @classdesc `{childNodes: ...AtomToken}`
8
+ * @classdesc `{childNodes: AtomToken[]}`
9
9
  */
10
10
  export declare abstract class ParamTagToken extends Token {
11
11
  readonly name: string;
@@ -14,7 +14,7 @@ const singleLine_1 = require("../../mixin/singleLine");
14
14
  /* NOT FOR BROWSER END */
15
15
  /**
16
16
  * `<dynamicpagelist>`
17
- * @classdesc `{childNodes: ...AtomToken}`
17
+ * @classdesc `{childNodes: AtomToken[]}`
18
18
  */
19
19
  class ParamTagToken extends index_2.Token {
20
20
  /* NOT FOR BROWSER END */
@@ -3,6 +3,8 @@ import { Token } from './index';
3
3
  import type { LintError, AST } from '../base';
4
4
  import type { AtomToken, SyntaxToken, TranscludeToken } from '../internal';
5
5
  /**
6
+ * template or magic word parameter
7
+ *
6
8
  * 模板或魔术字参数
7
9
  * @classdesc `{childNodes: [Token, Token]}`
8
10
  */
@@ -21,40 +23,50 @@ export declare abstract class ParameterToken extends Token {
21
23
  abstract get nextElementSibling(): this | undefined;
22
24
  abstract get previousElementSibling(): AtomToken | SyntaxToken | this;
23
25
  get type(): 'parameter';
24
- /** 是否是匿名参数 */
26
+ /** whether to be anonymous / 是否是匿名参数 */
25
27
  get anon(): boolean;
28
+ /** whether to be a duplicated parameter / 是否是重复参数 */
29
+ get duplicated(): boolean;
30
+ set duplicated(value: boolean);
26
31
  set anon(value: boolean);
27
- /** getValue()的getter */
32
+ /** parameter value / 参数值 */
28
33
  get value(): string;
29
34
  set value(value: string);
30
- /** 是否是重复参数 */
31
- get duplicated(): boolean;
32
- set duplicated(value: boolean);
33
35
  /**
34
36
  * @param key 参数名
35
37
  * @param value 参数值
36
38
  */
37
39
  constructor(key?: string | number, value?: string, config?: Parser.Config, accum?: Token[]);
38
40
  text(): string;
39
- /** @override */
40
- json(): AST;
41
41
  cloneNode(): this;
42
42
  safeReplaceWith(token: this): void;
43
- /** 获取参数值 */
43
+ /**
44
+ * Get the parameter value
45
+ *
46
+ * 获取参数值
47
+ */
44
48
  getValue(): string;
45
49
  /**
50
+ * Set the parameter value
51
+ *
46
52
  * 设置参数值
47
- * @param value 参数值
53
+ * @param value parameter value / 参数值
48
54
  */
49
55
  setValue(value: string): void;
50
56
  /**
57
+ * Rename the parameter
58
+ *
51
59
  * 修改参数名
52
- * @param key 新参数名
53
- * @param force 是否无视冲突命名
60
+ * @param key new parameter name / 新参数名
61
+ * @param force whether to rename regardless of conflicts / 是否无视冲突命名
54
62
  * @throws `Error` 仅用于模板参数
55
63
  * @throws `RangeError` 更名造成重复参数
56
64
  */
57
65
  rename(key: string, force?: boolean): void;
58
- /** 转义 `=` */
66
+ /**
67
+ * Ecape `=`
68
+ *
69
+ * 转义 `=`
70
+ */
59
71
  escape(): void;
60
72
  }
@@ -48,6 +48,8 @@ const fixed_1 = require("../mixin/fixed");
48
48
  /https?:\/\/(?:\[[\da-f:.]+\]|[^[\]<>"\t\n\p{Zs}])[^[\]<>"\0\t\n\p{Zs}]*$/iu;
49
49
  const linkRegex = new RegExp(`https?://${string_1.extUrlCharFirst}${string_1.extUrlChar}$`, 'iu');
50
50
  /**
51
+ * template or magic word parameter
52
+ *
51
53
  * 模板或魔术字参数
52
54
  * @classdesc `{childNodes: [Token, Token]}`
53
55
  */
@@ -70,25 +72,12 @@ let ParameterToken = (() => {
70
72
  get type() {
71
73
  return 'parameter';
72
74
  }
73
- /** 是否是匿名参数 */
75
+ /** whether to be anonymous / 是否是匿名参数 */
74
76
  get anon() {
75
77
  return this.firstChild.length === 0;
76
78
  }
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
- /** 是否是重复参数 */
79
+ /* PRINT ONLY */
80
+ /** whether to be a duplicated parameter / 是否是重复参数 */
92
81
  get duplicated() {
93
82
  try {
94
83
  return Boolean(this.parentNode?.getDuplicatedArgs().some(([key]) => key === this.name));
@@ -97,11 +86,26 @@ let ParameterToken = (() => {
97
86
  return false;
98
87
  }
99
88
  }
89
+ /* PRINT ONLY END */
90
+ /* NOT FOR BROWSER */
100
91
  set duplicated(value) {
101
92
  if (this.duplicated && !value) {
102
93
  this.parentNode.fixDuplication();
103
94
  }
104
95
  }
96
+ set anon(value) {
97
+ if (value) {
98
+ throw new Error('Cannot convert named parameter to anonymous parameter!');
99
+ }
100
+ this.parentNode?.anonToNamed();
101
+ }
102
+ /** parameter value / 参数值 */
103
+ get value() {
104
+ return this.getValue();
105
+ }
106
+ set value(value) {
107
+ this.setValue(value);
108
+ }
105
109
  /* NOT FOR BROWSER END */
106
110
  /**
107
111
  * @param key 参数名
@@ -185,10 +189,10 @@ let ParameterToken = (() => {
185
189
  print() {
186
190
  return super.print({ sep: this.anon ? '' : '=' });
187
191
  }
188
- /** @override */
189
- json() {
190
- const json = super.json();
191
- json['anon'] = this.anon;
192
+ /** @private */
193
+ json(_, start = this.getAbsoluteIndex()) {
194
+ const json = super.json(undefined, start);
195
+ Object.assign(json, { anon: this.anon, duplicated: this.duplicated });
192
196
  return json;
193
197
  }
194
198
  /* NOT FOR BROWSER */
@@ -209,23 +213,32 @@ let ParameterToken = (() => {
209
213
  index_1.default.warn(`${this.constructor.name}.safeReplaceWith regress to AstNode.replaceWith.`);
210
214
  this.replaceWith(token);
211
215
  }
212
- /** 获取参数值 */
216
+ /**
217
+ * Get the parameter value
218
+ *
219
+ * 获取参数值
220
+ */
213
221
  getValue() {
214
222
  const value = (0, string_1.removeCommentLine)(this.lastChild.text());
215
223
  return this.anon && this.parentNode?.isTemplate() !== false ? value : value.trim();
216
224
  }
217
225
  /**
226
+ * Set the parameter value
227
+ *
218
228
  * 设置参数值
219
- * @param value 参数值
229
+ * @param value parameter value / 参数值
220
230
  */
221
231
  setValue(value) {
222
- const { childNodes } = index_1.default.parse(value, this.getAttribute('include'), undefined, this.getAttribute('config'));
232
+ const { childNodes } = index_1.default
233
+ .parse(value, this.getAttribute('include'), undefined, this.getAttribute('config'));
223
234
  this.lastChild.replaceChildren(...childNodes);
224
235
  }
225
236
  /**
237
+ * Rename the parameter
238
+ *
226
239
  * 修改参数名
227
- * @param key 新参数名
228
- * @param force 是否无视冲突命名
240
+ * @param key new parameter name / 新参数名
241
+ * @param force whether to rename regardless of conflicts / 是否无视冲突命名
229
242
  * @throws `Error` 仅用于模板参数
230
243
  * @throws `RangeError` 更名造成重复参数
231
244
  */
@@ -238,7 +251,8 @@ let ParameterToken = (() => {
238
251
  else if (anon) {
239
252
  parentNode?.anonToNamed();
240
253
  }
241
- const root = index_1.default.parse(key, this.getAttribute('include'), undefined, this.getAttribute('config')), name = this.trimName(root, false);
254
+ const root = index_1.default
255
+ .parse(key, this.getAttribute('include'), undefined, this.getAttribute('config')), name = this.trimName(root, false);
242
256
  if (this.name === name) {
243
257
  index_1.default.warn('The actual parameter name is not changed', name);
244
258
  }
@@ -252,7 +266,11 @@ let ParameterToken = (() => {
252
266
  }
253
267
  this.firstChild.replaceChildren(...root.childNodes);
254
268
  }
255
- /** 转义 `=` */
269
+ /**
270
+ * Ecape `=`
271
+ *
272
+ * 转义 `=`
273
+ */
256
274
  escape() {
257
275
  for (const child of this.lastChild.childNodes) {
258
276
  if (child.type === 'text') {
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
@@ -9,7 +9,7 @@ const noinclude_1 = require("./nowiki/noinclude");
9
9
  const debug_1 = require("../util/debug");
10
10
  /**
11
11
  * `<pre>`
12
- * @classdesc `{childNodes: [...AstText|NoincludeToken|ConverterToken]}`
12
+ * @classdesc `{childNodes: (AstText|NoincludeToken|ConverterToken)[]}`
13
13
  */
14
14
  class PreToken extends index_2.Token {
15
15
  /* NOT FOR BROWSER END */
@@ -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
  */
@@ -46,6 +46,8 @@ const debug_1 = require("../util/debug");
46
46
  const fixed_1 = require("../mixin/fixed");
47
47
  /* NOT FOR BROWSER END */
48
48
  /**
49
+ * redirect
50
+ *
49
51
  * 重定向
50
52
  * @classdesc `{childNodes: [SyntaxToken, LinkToken]}`
51
53
  */
@@ -4,7 +4,11 @@ import type { SyntaxBase } from '../mixin/syntax';
4
4
  export interface SyntaxToken extends SyntaxBase {
5
5
  }
6
6
  declare type SyntaxTypes = 'heading-trail' | 'magic-word-name' | 'table-syntax' | 'redirect-syntax';
7
- /** 满足特定语法格式的plain Token */
7
+ /**
8
+ * plain token that satisfies specific grammar syntax
9
+ *
10
+ * 满足特定语法格式的plain Token
11
+ */
8
12
  export declare class SyntaxToken extends Token {
9
13
  #private;
10
14
  get type(): SyntaxTypes;
@@ -40,7 +40,11 @@ const index_1 = require("./index");
40
40
  const debug_1 = require("../util/debug");
41
41
  const constants_1 = require("../util/constants");
42
42
  const syntax_1 = require("../mixin/syntax");
43
- /** 满足特定语法格式的plain Token */
43
+ /**
44
+ * plain token that satisfies specific grammar syntax
45
+ *
46
+ * 满足特定语法格式的plain Token
47
+ */
44
48
  let SyntaxToken = (() => {
45
49
  let _classDecorators = [(0, syntax_1.syntax)()];
46
50
  let _classDescriptor;
@@ -22,7 +22,11 @@ export declare abstract class TableBaseToken extends Token {
22
22
  */
23
23
  constructor(pattern: RegExp, syntax: string, type: TableTypes, attr?: string, config?: Parser.Config, accum?: Token[], acceptable?: Acceptable);
24
24
  cloneNode(): this;
25
- /** 转义表格语法 */
25
+ /**
26
+ * Escape the table syntax
27
+ *
28
+ * 转义表格语法
29
+ */
26
30
  escape(): void;
27
31
  }
28
32
  export {};
@@ -16,12 +16,15 @@ const constants_1 = require("../../util/constants");
16
16
  const escapeTable = (syntax) => {
17
17
  const wikitext = syntax.childNodes.map(child => child.type === 'text'
18
18
  ? child.data.replaceAll('|', '{{!}}')
19
- : child.toString()).join(''), { childNodes } = index_1.default.parse(wikitext, syntax.getAttribute('include'), 2, syntax.getAttribute('config'));
19
+ : child.toString()).join(''), { childNodes } = index_1.default
20
+ .parse(wikitext, syntax.getAttribute('include'), 2, syntax.getAttribute('config'));
20
21
  syntax.replaceChildren(...childNodes);
21
22
  };
22
23
  /**
24
+ * table row that contains the newline at the beginning but not at the end
25
+ *
23
26
  * 表格行,含开头的换行,不含结尾的换行
24
- * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token]}`
27
+ * @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...Token[]]}`
25
28
  */
26
29
  class TableBaseToken extends (0, attributesParent_1.attributesParent)(1)(index_2.Token) {
27
30
  /* NOT FOR BROWSER END */
@@ -57,7 +60,11 @@ class TableBaseToken extends (0, attributesParent_1.attributesParent)(1)(index_2
57
60
  return token;
58
61
  });
59
62
  }
60
- /** 转义表格语法 */
63
+ /**
64
+ * Escape the table syntax
65
+ *
66
+ * 转义表格语法
67
+ */
61
68
  escape() {
62
69
  for (const child of this.childNodes) {
63
70
  if (child instanceof syntax_1.SyntaxToken) {