wikiparser-node 1.11.0 → 1.11.1-b

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 (172) hide show
  1. package/bundle/bundle.min.js +38 -0
  2. package/config/enwiki.json +1 -814
  3. package/config/llwiki.json +1 -35
  4. package/config/moegirl.json +1 -44
  5. package/config/zhwiki.json +1 -466
  6. package/extensions/dist/base.js +64 -0
  7. package/extensions/dist/editor.js +159 -0
  8. package/extensions/dist/highlight.js +56 -0
  9. package/extensions/dist/lint.js +72 -0
  10. package/extensions/editor.css +64 -0
  11. package/extensions/ui.css +144 -0
  12. package/package.json +28 -35
  13. package/config/.schema.json +0 -186
  14. package/dist/addon/table.js +0 -486
  15. package/dist/addon/token.js +0 -304
  16. package/dist/addon/transclude.js +0 -184
  17. package/dist/base.d.ts +0 -81
  18. package/dist/base.js +0 -39
  19. package/dist/index.d.ts +0 -33
  20. package/dist/index.js +0 -235
  21. package/dist/internal.d.ts +0 -46
  22. package/dist/lib/element.d.ts +0 -125
  23. package/dist/lib/element.js +0 -375
  24. package/dist/lib/node.d.ts +0 -173
  25. package/dist/lib/node.js +0 -478
  26. package/dist/lib/range.d.ts +0 -105
  27. package/dist/lib/range.js +0 -406
  28. package/dist/lib/ranges.d.ts +0 -28
  29. package/dist/lib/ranges.js +0 -126
  30. package/dist/lib/rect.d.ts +0 -18
  31. package/dist/lib/rect.js +0 -34
  32. package/dist/lib/text.d.ts +0 -58
  33. package/dist/lib/text.js +0 -400
  34. package/dist/lib/title.d.ts +0 -42
  35. package/dist/lib/title.js +0 -208
  36. package/dist/mixin/attributesParent.d.ts +0 -49
  37. package/dist/mixin/attributesParent.js +0 -79
  38. package/dist/mixin/fixed.d.ts +0 -5
  39. package/dist/mixin/fixed.js +0 -32
  40. package/dist/mixin/flagsParent.d.ts +0 -43
  41. package/dist/mixin/flagsParent.js +0 -64
  42. package/dist/mixin/hidden.d.ts +0 -7
  43. package/dist/mixin/hidden.js +0 -37
  44. package/dist/mixin/magicLinkParent.d.ts +0 -19
  45. package/dist/mixin/magicLinkParent.js +0 -43
  46. package/dist/mixin/singleLine.d.ts +0 -5
  47. package/dist/mixin/singleLine.js +0 -25
  48. package/dist/mixin/sol.d.ts +0 -6
  49. package/dist/mixin/sol.js +0 -45
  50. package/dist/mixin/syntax.d.ts +0 -8
  51. package/dist/mixin/syntax.js +0 -46
  52. package/dist/parser/braces.js +0 -150
  53. package/dist/parser/commentAndExt.js +0 -79
  54. package/dist/parser/converter.js +0 -39
  55. package/dist/parser/externalLinks.js +0 -37
  56. package/dist/parser/hrAndDoubleUnderscore.js +0 -42
  57. package/dist/parser/html.js +0 -38
  58. package/dist/parser/links.js +0 -101
  59. package/dist/parser/list.js +0 -114
  60. package/dist/parser/magicLinks.js +0 -52
  61. package/dist/parser/quotes.js +0 -67
  62. package/dist/parser/redirect.js +0 -26
  63. package/dist/parser/selector.js +0 -394
  64. package/dist/parser/table.js +0 -123
  65. package/dist/src/arg.d.ts +0 -51
  66. package/dist/src/arg.js +0 -214
  67. package/dist/src/atom.d.ts +0 -14
  68. package/dist/src/atom.js +0 -52
  69. package/dist/src/attribute.d.ts +0 -64
  70. package/dist/src/attribute.js +0 -480
  71. package/dist/src/attributes.d.ts +0 -101
  72. package/dist/src/attributes.js +0 -381
  73. package/dist/src/converter.d.ts +0 -28
  74. package/dist/src/converter.js +0 -148
  75. package/dist/src/converterFlags.d.ts +0 -80
  76. package/dist/src/converterFlags.js +0 -239
  77. package/dist/src/converterRule.d.ts +0 -71
  78. package/dist/src/converterRule.js +0 -216
  79. package/dist/src/extLink.d.ts +0 -36
  80. package/dist/src/extLink.js +0 -218
  81. package/dist/src/gallery.d.ts +0 -47
  82. package/dist/src/gallery.js +0 -143
  83. package/dist/src/heading.d.ts +0 -40
  84. package/dist/src/heading.js +0 -192
  85. package/dist/src/hidden.d.ts +0 -9
  86. package/dist/src/hidden.js +0 -80
  87. package/dist/src/html.d.ts +0 -61
  88. package/dist/src/html.js +0 -343
  89. package/dist/src/imageParameter.d.ts +0 -60
  90. package/dist/src/imageParameter.js +0 -260
  91. package/dist/src/imagemap.d.ts +0 -47
  92. package/dist/src/imagemap.js +0 -146
  93. package/dist/src/imagemapLink.d.ts +0 -31
  94. package/dist/src/imagemapLink.js +0 -97
  95. package/dist/src/index.d.ts +0 -136
  96. package/dist/src/index.js +0 -834
  97. package/dist/src/link/base.d.ts +0 -52
  98. package/dist/src/link/base.js +0 -256
  99. package/dist/src/link/category.d.ts +0 -22
  100. package/dist/src/link/category.js +0 -34
  101. package/dist/src/link/file.d.ts +0 -102
  102. package/dist/src/link/file.js +0 -333
  103. package/dist/src/link/galleryImage.d.ts +0 -29
  104. package/dist/src/link/galleryImage.js +0 -132
  105. package/dist/src/link/index.d.ts +0 -39
  106. package/dist/src/link/index.js +0 -98
  107. package/dist/src/link/redirectTarget.d.ts +0 -27
  108. package/dist/src/link/redirectTarget.js +0 -69
  109. package/dist/src/magicLink.d.ts +0 -58
  110. package/dist/src/magicLink.js +0 -256
  111. package/dist/src/nested.d.ts +0 -40
  112. package/dist/src/nested.js +0 -106
  113. package/dist/src/nowiki/base.d.ts +0 -28
  114. package/dist/src/nowiki/base.js +0 -89
  115. package/dist/src/nowiki/comment.d.ts +0 -14
  116. package/dist/src/nowiki/comment.js +0 -121
  117. package/dist/src/nowiki/dd.d.ts +0 -8
  118. package/dist/src/nowiki/dd.js +0 -72
  119. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
  120. package/dist/src/nowiki/doubleUnderscore.js +0 -97
  121. package/dist/src/nowiki/hr.d.ts +0 -5
  122. package/dist/src/nowiki/hr.js +0 -70
  123. package/dist/src/nowiki/index.d.ts +0 -14
  124. package/dist/src/nowiki/index.js +0 -28
  125. package/dist/src/nowiki/list.d.ts +0 -5
  126. package/dist/src/nowiki/list.js +0 -65
  127. package/dist/src/nowiki/listBase.d.ts +0 -23
  128. package/dist/src/nowiki/listBase.js +0 -99
  129. package/dist/src/nowiki/noinclude.d.ts +0 -6
  130. package/dist/src/nowiki/noinclude.js +0 -75
  131. package/dist/src/nowiki/quote.d.ts +0 -14
  132. package/dist/src/nowiki/quote.js +0 -140
  133. package/dist/src/onlyinclude.d.ts +0 -13
  134. package/dist/src/onlyinclude.js +0 -58
  135. package/dist/src/paramTag/index.d.ts +0 -28
  136. package/dist/src/paramTag/index.js +0 -78
  137. package/dist/src/paramTag/inputbox.d.ts +0 -8
  138. package/dist/src/paramTag/inputbox.js +0 -22
  139. package/dist/src/parameter.d.ts +0 -60
  140. package/dist/src/parameter.js +0 -264
  141. package/dist/src/pre.d.ts +0 -28
  142. package/dist/src/pre.js +0 -60
  143. package/dist/src/redirect.d.ts +0 -30
  144. package/dist/src/redirect.js +0 -126
  145. package/dist/src/syntax.d.ts +0 -17
  146. package/dist/src/syntax.js +0 -87
  147. package/dist/src/table/base.d.ts +0 -28
  148. package/dist/src/table/base.js +0 -81
  149. package/dist/src/table/index.d.ts +0 -230
  150. package/dist/src/table/index.js +0 -506
  151. package/dist/src/table/td.d.ts +0 -72
  152. package/dist/src/table/td.js +0 -370
  153. package/dist/src/table/tr.d.ts +0 -30
  154. package/dist/src/table/tr.js +0 -59
  155. package/dist/src/table/trBase.d.ts +0 -49
  156. package/dist/src/table/trBase.js +0 -164
  157. package/dist/src/tagPair/ext.d.ts +0 -29
  158. package/dist/src/tagPair/ext.js +0 -220
  159. package/dist/src/tagPair/include.d.ts +0 -33
  160. package/dist/src/tagPair/include.js +0 -130
  161. package/dist/src/tagPair/index.d.ts +0 -23
  162. package/dist/src/tagPair/index.js +0 -128
  163. package/dist/src/transclude.d.ts +0 -159
  164. package/dist/src/transclude.js +0 -587
  165. package/dist/util/constants.js +0 -25
  166. package/dist/util/debug.js +0 -95
  167. package/dist/util/diff.js +0 -83
  168. package/dist/util/html.js +0 -143
  169. package/dist/util/lint.js +0 -32
  170. package/dist/util/string.js +0 -87
  171. package/errors/README +0 -3
  172. package/printed/README +0 -3
@@ -1,52 +0,0 @@
1
- import Parser from '../../index';
2
- import { Token } from '../index';
3
- import { AtomToken } from '../atom';
4
- import type { LintError } from '../../base';
5
- import type { Title } from '../../lib/title';
6
- /**
7
- * 内链
8
- * @classdesc `{childNodes: [AtomToken, ...Token]}`
9
- */
10
- export declare abstract class LinkBaseToken extends Token {
11
- #private;
12
- readonly name: string;
13
- abstract get type(): 'link' | 'category' | 'file' | 'gallery-image' | 'imagemap-image' | 'redirect-target';
14
- readonly childNodes: readonly [AtomToken, ...Token[]];
15
- abstract get firstChild(): AtomToken;
16
- abstract get lastChild(): Token;
17
- abstract get children(): [AtomToken, ...Token[]];
18
- abstract get firstElementChild(): AtomToken;
19
- abstract get lastElementChild(): Token;
20
- /** 完整链接 */
21
- get link(): string | Title;
22
- set link(link: string);
23
- /** fragment */
24
- get fragment(): string | undefined;
25
- set fragment(fragment: string | undefined);
26
- /** interwiki */
27
- get interwiki(): string;
28
- /** @throws `RangeError` 非法的跨维基前缀 */
29
- set interwiki(interwiki: string);
30
- /**
31
- * @param link 链接标题
32
- * @param linkText 链接显示文字
33
- * @param delimiter `|`
34
- */
35
- constructor(link: string, linkText?: string, config?: Parser.Config, accum?: Token[], delimiter?: string);
36
- cloneNode(): this;
37
- /**
38
- * 设置链接目标
39
- * @param link 链接目标
40
- */
41
- setTarget(link: string): void;
42
- /**
43
- * 设置fragment
44
- * @param fragment fragment
45
- */
46
- setFragment(fragment?: string): void;
47
- /**
48
- * 设置链接显示文字
49
- * @param linkStr 链接显示文字
50
- */
51
- setLinkText(linkStr?: string): void;
52
- }
@@ -1,256 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LinkBaseToken = void 0;
4
- const lint_1 = require("../../util/lint");
5
- const constants_1 = require("../../util/constants");
6
- const debug_1 = require("../../util/debug");
7
- const string_1 = require("../../util/string");
8
- const html_1 = require("../../util/html");
9
- const rect_1 = require("../../lib/rect");
10
- const index_1 = require("../../index");
11
- const index_2 = require("../index");
12
- const atom_1 = require("../atom");
13
- /**
14
- * 是否为普通内链
15
- * @param type 节点类型
16
- */
17
- const isLink = (type) => type === 'redirect-target' || type === 'link';
18
- /**
19
- * 内链
20
- * @classdesc `{childNodes: [AtomToken, ...Token]}`
21
- */
22
- class LinkBaseToken extends index_2.Token {
23
- #bracket = true;
24
- #delimiter;
25
- #title;
26
- /** 完整链接 */
27
- get link() {
28
- return this.#title;
29
- }
30
- set link(link) {
31
- this.setTarget(link);
32
- }
33
- /** fragment */
34
- get fragment() {
35
- return this.#title.fragment;
36
- }
37
- set fragment(fragment) {
38
- this.setFragment(fragment);
39
- }
40
- /** interwiki */
41
- get interwiki() {
42
- return this.#title.interwiki;
43
- }
44
- /** @throws `RangeError` 非法的跨维基前缀 */
45
- set interwiki(interwiki) {
46
- if (isLink(this.type)) {
47
- const { prefix, main, fragment } = this.#title, link = `${interwiki}:${prefix}${main}${fragment === undefined ? '' : `#${fragment}`}`;
48
- if (interwiki && !this.isInterwiki(link)) {
49
- throw new RangeError(`${interwiki} is not a valid interwiki prefix!`);
50
- }
51
- this.setTarget(link);
52
- }
53
- }
54
- /* NOT FOR BROWSER END */
55
- /**
56
- * @param link 链接标题
57
- * @param linkText 链接显示文字
58
- * @param delimiter `|`
59
- */
60
- constructor(link, linkText, config = index_1.default.getConfig(), accum = [], delimiter = '|') {
61
- super(undefined, config, accum, {
62
- AtomToken: 0, Token: 1,
63
- });
64
- this.insertAt(new atom_1.AtomToken(link, 'link-target', config, accum, {
65
- 'Stage-2': ':', '!ExtToken': '', '!HeadingToken': '',
66
- }));
67
- if (linkText !== undefined) {
68
- const inner = new index_2.Token(linkText, config, accum, {
69
- 'Stage-5': ':', QuoteToken: ':', ConverterToken: ':',
70
- });
71
- inner.type = 'link-text';
72
- inner.setAttribute('stage', constants_1.MAX_STAGE - 1);
73
- this.insertAt(inner);
74
- }
75
- this.#delimiter = delimiter;
76
- /* NOT FOR BROWSER */
77
- this.protectChildren(0);
78
- }
79
- /** @private */
80
- afterBuild() {
81
- this.#title = this.getTitle();
82
- if (this.#delimiter.includes('\0')) {
83
- this.#delimiter = this.buildFromStr(this.#delimiter, constants_1.BuildMethod.String);
84
- }
85
- this.setAttribute('name', this.#title.title);
86
- super.afterBuild();
87
- /* NOT FOR BROWSER */
88
- const /** @implements */ linkListener = (e, data) => {
89
- const { prevTarget } = e, { type } = this;
90
- if (prevTarget?.type === 'link-target') {
91
- const name = prevTarget.toString(true), titleObj = this.getTitle(), { title, interwiki, ns, valid } = titleObj;
92
- if (!valid) {
93
- (0, debug_1.undo)(e, data);
94
- throw new Error(`Invalid link target: ${name}`);
95
- }
96
- else if (type === 'category' && (interwiki || ns !== 14)
97
- || (type === 'file' || type === 'gallery-image' || type === 'imagemap-image')
98
- && (interwiki || ns !== 6)) {
99
- (0, debug_1.undo)(e, data);
100
- throw new Error(`${type === 'category' ? 'Category' : 'File'} link cannot change namespace: ${name}`);
101
- }
102
- else if (type === 'link' && !interwiki && (ns === 6 || ns === 14) && !name.trim().startsWith(':')) {
103
- const { firstChild } = prevTarget;
104
- if (firstChild?.type === 'text') {
105
- firstChild.insertData(0, ':');
106
- }
107
- else {
108
- prevTarget.prepend(':');
109
- }
110
- }
111
- this.#title = titleObj;
112
- this.setAttribute('name', title);
113
- }
114
- };
115
- this.addEventListener(['remove', 'insert', 'replace', 'text'], linkListener);
116
- }
117
- /** @private */
118
- setAttribute(key, value) {
119
- if (key === 'bracket') {
120
- this.#bracket = value;
121
- }
122
- else if (key === 'title') {
123
- this.#title = value;
124
- }
125
- else {
126
- super.setAttribute(key, value);
127
- }
128
- }
129
- /** @private */
130
- toString(skip) {
131
- const str = super.toString(skip, this.#delimiter);
132
- return this.#bracket ? `[[${str}]]` : str;
133
- }
134
- /** @private */
135
- text() {
136
- const str = super.text('|');
137
- return this.#bracket ? `[[${str}]]` : str;
138
- }
139
- /** @private */
140
- getAttribute(key) {
141
- if (key === 'title') {
142
- return this.#title;
143
- }
144
- return key === 'padding' ? 2 : super.getAttribute(key);
145
- }
146
- /** @private */
147
- getGaps(i) {
148
- return i === 0 ? this.#delimiter.length : 1;
149
- }
150
- /** @private */
151
- lint(start = this.getAbsoluteIndex(), re) {
152
- const errors = super.lint(start, re), { childNodes: [target, linkText], type } = this, { encoded, fragment } = this.#title, rect = new rect_1.BoundingRect(this, start);
153
- if (target.childNodes.some(({ type: t }) => t === 'template')) {
154
- errors.push((0, lint_1.generateForChild)(target, rect, 'unknown-page', 'template in an internal link target', 'warning'));
155
- }
156
- if (encoded) {
157
- errors.push((0, lint_1.generateForChild)(target, rect, 'url-encoding', 'unnecessary URL encoding in an internal link'));
158
- }
159
- if (type === 'link' || type === 'category') {
160
- const textNode = linkText?.childNodes.find((c) => c.type === 'text' && c.data.includes('|'));
161
- if (textNode) {
162
- const e = (0, lint_1.generateForChild)(linkText, rect, 'pipe-like', 'additional "|" in the link text', 'warning'), i = e.startIndex + textNode.getRelativeIndex();
163
- e.suggestions = [
164
- {
165
- desc: 'escape',
166
- range: [i, i + textNode.data.length],
167
- text: textNode.data.replace(/\|/gu, '|'),
168
- },
169
- ];
170
- errors.push(e);
171
- }
172
- }
173
- if (fragment !== undefined && !isLink(type)) {
174
- const e = (0, lint_1.generateForChild)(target, rect, 'no-ignored', 'useless fragment'), textNode = target.childNodes.find((c) => c.type === 'text' && c.data.includes('#'));
175
- if (textNode) {
176
- e.fix = {
177
- range: [e.startIndex + textNode.getRelativeIndex() + textNode.data.indexOf('#'), e.endIndex],
178
- text: '',
179
- };
180
- }
181
- errors.push(e);
182
- }
183
- return errors;
184
- }
185
- /** @private */
186
- getTitle(halfParsed) {
187
- return this.normalizeTitle(this.firstChild.toString(true), 0, halfParsed, true, true);
188
- }
189
- /** @private */
190
- print() {
191
- return super.print(this.#bracket ? { pre: '[[', post: ']]', sep: this.#delimiter } : { sep: this.#delimiter });
192
- }
193
- /* NOT FOR BROWSER */
194
- cloneNode() {
195
- const [link, ...linkText] = this.cloneChildNodes();
196
- return debug_1.Shadow.run(() => {
197
- const C = this.constructor, token = new C('', undefined, this.getAttribute('config'));
198
- token.firstChild.safeReplaceWith(link);
199
- token.append(...linkText);
200
- return token;
201
- });
202
- }
203
- /**
204
- * 设置链接目标
205
- * @param link 链接目标
206
- */
207
- setTarget(link) {
208
- const config = this.getAttribute('config'), { childNodes } = index_1.default.parse(link, this.getAttribute('include'), 2, config), token = debug_1.Shadow.run(() => new atom_1.AtomToken(undefined, 'link-target', config, [], {
209
- 'Stage-2': ':', '!ExtToken': '', '!HeadingToken': '',
210
- }));
211
- token.append(...childNodes);
212
- this.firstChild.safeReplaceWith(token);
213
- }
214
- /**
215
- * 设置fragment
216
- * @param fragment fragment
217
- */
218
- setFragment(fragment) {
219
- const { type, name } = this;
220
- if (fragment === undefined || isLink(type)) {
221
- fragment &&= (0, string_1.encode)(fragment);
222
- this.setTarget(`${name}${fragment === undefined ? '' : `#${fragment}`}`);
223
- }
224
- }
225
- /**
226
- * 设置链接显示文字
227
- * @param linkStr 链接显示文字
228
- */
229
- setLinkText(linkStr) {
230
- if (linkStr === undefined) {
231
- this.childNodes[1]?.remove();
232
- return;
233
- }
234
- const root = index_1.default.parse(linkStr, this.getAttribute('include'), undefined, this.getAttribute('config'));
235
- if (this.length === 1) {
236
- root.type = 'link-text';
237
- root.setAttribute('acceptable', {
238
- 'Stage-5': ':', QuoteToken: ':', ConverterToken: ':',
239
- });
240
- this.insertAt(root);
241
- }
242
- else {
243
- this.lastChild.replaceChildren(...root.childNodes);
244
- }
245
- }
246
- /** @private */
247
- toHtmlInternal() {
248
- if (this.is('link') || this.is('redirect-target')) {
249
- const { link, length, lastChild, type } = this, title = link.getTitleAttr();
250
- return (0, html_1.font)(this, `<a${link.interwiki && ' class="extiw"'} href="${link.getUrl()}"${title && ` title="${title}"`}>${type === 'link' && length > 1 ? lastChild.toHtmlInternal(true) : (0, string_1.sanitize)(this.innerText)}</a>`);
251
- }
252
- return '';
253
- }
254
- }
255
- exports.LinkBaseToken = LinkBaseToken;
256
- constants_1.classes['LinkBaseToken'] = __filename;
@@ -1,22 +0,0 @@
1
- import { LinkBaseToken } from './base';
2
- import type { Title } from '../../lib/title';
3
- import type { Token, AtomToken } from '../../internal';
4
- /**
5
- * 分类
6
- * @classdesc `{childNodes: [AtomToken, ?Token]}`
7
- */
8
- export declare abstract class CategoryToken extends LinkBaseToken {
9
- readonly childNodes: readonly [AtomToken] | readonly [AtomToken, Token];
10
- abstract get children(): [AtomToken] | [AtomToken, Token];
11
- abstract get link(): Title;
12
- abstract set link(link: string);
13
- get type(): 'category';
14
- /** 分类排序关键字 */
15
- get sortkey(): string | undefined;
16
- set sortkey(text: string | undefined);
17
- /**
18
- * 设置排序关键字
19
- * @param text 排序关键字
20
- */
21
- setSortkey(text?: string): void;
22
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CategoryToken = void 0;
4
- const string_1 = require("../../util/string");
5
- const constants_1 = require("../../util/constants");
6
- const base_1 = require("./base");
7
- /**
8
- * 分类
9
- * @classdesc `{childNodes: [AtomToken, ?Token]}`
10
- */
11
- class CategoryToken extends base_1.LinkBaseToken {
12
- /* NOT FOR BROWSER END */
13
- get type() {
14
- return 'category';
15
- }
16
- /* NOT FOR BROWSER */
17
- /** 分类排序关键字 */
18
- get sortkey() {
19
- const { childNodes: [, child] } = this;
20
- return child && (0, string_1.decodeHtml)(child.text());
21
- }
22
- set sortkey(text) {
23
- this.setSortkey(text);
24
- }
25
- /**
26
- * 设置排序关键字
27
- * @param text 排序关键字
28
- */
29
- setSortkey(text) {
30
- this.setLinkText(text);
31
- }
32
- }
33
- exports.CategoryToken = CategoryToken;
34
- constants_1.classes['CategoryToken'] = __filename;
@@ -1,102 +0,0 @@
1
- import { Title } from '../../lib/title';
2
- import Parser from '../../index';
3
- import { LinkBaseToken } from './base';
4
- import { ImageParameterToken } from '../imageParameter';
5
- import type { LintError } from '../../base';
6
- import type { Token, AtomToken } from '../../internal';
7
- /**
8
- * 图片
9
- * @classdesc `{childNodes: [AtomToken, ...ImageParameterToken]}`
10
- */
11
- export declare abstract class FileToken extends LinkBaseToken {
12
- #private;
13
- readonly childNodes: readonly [AtomToken, ...ImageParameterToken[]];
14
- abstract get lastChild(): AtomToken | ImageParameterToken;
15
- abstract get children(): [AtomToken, ...ImageParameterToken[]];
16
- abstract get lastElementChild(): AtomToken | ImageParameterToken;
17
- get type(): 'file' | 'gallery-image' | 'imagemap-image';
18
- /** 扩展名 */
19
- get extension(): string | undefined;
20
- /** 图片链接 */
21
- get link(): string | Title;
22
- set link(value: string);
23
- /** 图片大小 */
24
- get size(): {
25
- width: string;
26
- height: string;
27
- } | undefined;
28
- set size(size: {
29
- width: string;
30
- height: string;
31
- } | undefined);
32
- /** 图片宽度 */
33
- get width(): string | undefined;
34
- set width(width: string | undefined);
35
- /** 图片高度 */
36
- get height(): string | undefined;
37
- set height(height: string | undefined);
38
- /**
39
- * @param link 文件名
40
- * @param text 图片参数
41
- * @param delimiter `|`
42
- */
43
- constructor(link: string, text?: string, config?: Parser.Config, accum?: Token[], delimiter?: string);
44
- /** 获取所有图片参数节点 */
45
- getAllArgs(): ImageParameterToken[];
46
- /**
47
- * 获取指定图片参数
48
- * @param key 参数名
49
- */
50
- getArgs(key: string): ImageParameterToken[];
51
- /**
52
- * 获取生效的指定图片参数
53
- * @param key 参数名
54
- */
55
- getArg(key: string): ImageParameterToken | undefined;
56
- /**
57
- * 获取生效的指定图片参数值
58
- * @param key 参数名
59
- */
60
- getValue(key: string): string | true | undefined;
61
- /** 获取图片框架属性参数节点 */
62
- getFrameArgs(): ImageParameterToken[];
63
- /** 获取图片水平对齐参数节点 */
64
- getHorizAlignArgs(): ImageParameterToken[];
65
- /** 获取图片垂直对齐参数节点 */
66
- getVertAlignArgs(): ImageParameterToken[];
67
- /** 获取生效的图片框架属性参数 */
68
- getFrame(): string | Title | undefined;
69
- /** 获取生效的图片水平对齐参数 */
70
- getHorizAlign(): string | undefined;
71
- /** 获取生效的图片垂直对齐参数 */
72
- getVertAlign(): string | undefined;
73
- /**
74
- * 是否具有指定图片参数
75
- * @param key 参数名
76
- */
77
- hasArg(key: string): boolean;
78
- /**
79
- * 移除指定图片参数
80
- * @param key 参数名
81
- */
82
- removeArg(key: string): void;
83
- /** 获取图片参数名 */
84
- getKeys(): Set<string>;
85
- /**
86
- * 获取指定的图片参数值
87
- * @param key 参数名
88
- */
89
- getValues(key: string): (string | true)[];
90
- /**
91
- * 设置图片参数
92
- * @param key 参数名
93
- * @param value 参数值
94
- * @throws `RangeError` 未定义的图片参数
95
- */
96
- setValue(key: string, value?: string | boolean): void;
97
- /**
98
- * @override
99
- * @throws `Error` 不适用于图片
100
- */
101
- setLinkText(): never;
102
- }