wikiparser-node 1.0.0-beta.4 → 1.0.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.
- package/README.md +10 -9
- package/bundle/bundle.min.js +37 -0
- package/config/llwiki.json +1 -35
- package/config/moegirl.json +1 -44
- package/config/zhwiki.json +1 -466
- package/extensions/dist/base.js +105 -0
- package/extensions/dist/editor.js +172 -0
- package/extensions/dist/highlight.js +46 -0
- package/extensions/dist/lint.js +43 -0
- package/extensions/editor.css +63 -0
- package/extensions/ui.css +119 -0
- package/package.json +29 -16
- package/config/.schema.json +0 -160
- package/dist/index.d.ts +0 -62
- package/dist/index.js +0 -305
- package/dist/internal.d.ts +0 -44
- package/dist/lib/element.d.ts +0 -190
- package/dist/lib/element.js +0 -674
- package/dist/lib/node.d.ts +0 -178
- package/dist/lib/node.js +0 -457
- package/dist/lib/range.d.ts +0 -132
- package/dist/lib/range.js +0 -384
- package/dist/lib/ranges.d.ts +0 -28
- package/dist/lib/ranges.js +0 -125
- package/dist/lib/text.d.ts +0 -78
- package/dist/lib/text.js +0 -227
- package/dist/lib/title.d.ts +0 -34
- package/dist/lib/title.js +0 -111
- package/dist/mixin/attributesParent.js +0 -93
- package/dist/mixin/fixed.js +0 -32
- package/dist/mixin/hidden.js +0 -23
- package/dist/mixin/singleLine.js +0 -26
- package/dist/mixin/sol.js +0 -44
- package/dist/parser/braces.js +0 -120
- package/dist/parser/commentAndExt.js +0 -64
- package/dist/parser/converter.js +0 -39
- package/dist/parser/externalLinks.js +0 -27
- package/dist/parser/hrAndDoubleUnderscore.js +0 -37
- package/dist/parser/html.js +0 -35
- package/dist/parser/links.js +0 -93
- package/dist/parser/list.js +0 -58
- package/dist/parser/magicLinks.js +0 -39
- package/dist/parser/quotes.js +0 -66
- package/dist/parser/selector.js +0 -162
- package/dist/parser/table.js +0 -108
- package/dist/src/arg.d.ts +0 -78
- package/dist/src/arg.js +0 -203
- package/dist/src/atom.d.ts +0 -12
- package/dist/src/atom.js +0 -24
- package/dist/src/attribute.d.ts +0 -107
- package/dist/src/attribute.js +0 -446
- package/dist/src/attributes.d.ts +0 -120
- package/dist/src/attributes.js +0 -360
- package/dist/src/converter.d.ts +0 -76
- package/dist/src/converter.js +0 -134
- package/dist/src/converterFlags.d.ts +0 -108
- package/dist/src/converterFlags.js +0 -237
- package/dist/src/converterRule.d.ts +0 -97
- package/dist/src/converterRule.js +0 -253
- package/dist/src/extLink.d.ts +0 -64
- package/dist/src/extLink.js +0 -156
- package/dist/src/gallery.d.ts +0 -72
- package/dist/src/gallery.js +0 -133
- package/dist/src/heading.d.ts +0 -84
- package/dist/src/heading.js +0 -134
- package/dist/src/hidden.d.ts +0 -20
- package/dist/src/hidden.js +0 -26
- package/dist/src/html.d.ts +0 -115
- package/dist/src/html.js +0 -247
- package/dist/src/imageParameter.d.ts +0 -83
- package/dist/src/imageParameter.js +0 -255
- package/dist/src/imagemap.d.ts +0 -79
- package/dist/src/imagemap.js +0 -164
- package/dist/src/imagemapLink.d.ts +0 -49
- package/dist/src/imagemapLink.js +0 -39
- package/dist/src/index.d.ts +0 -157
- package/dist/src/index.js +0 -818
- package/dist/src/link/base.d.ts +0 -70
- package/dist/src/link/base.js +0 -229
- package/dist/src/link/category.d.ts +0 -14
- package/dist/src/link/category.js +0 -29
- package/dist/src/link/file.d.ts +0 -106
- package/dist/src/link/file.js +0 -271
- package/dist/src/link/galleryImage.d.ts +0 -37
- package/dist/src/link/galleryImage.js +0 -101
- package/dist/src/link/index.d.ts +0 -50
- package/dist/src/link/index.js +0 -136
- package/dist/src/magicLink.d.ts +0 -47
- package/dist/src/magicLink.js +0 -130
- package/dist/src/nested.d.ts +0 -49
- package/dist/src/nested.js +0 -88
- package/dist/src/nowiki/base.d.ts +0 -39
- package/dist/src/nowiki/base.js +0 -31
- package/dist/src/nowiki/comment.d.ts +0 -43
- package/dist/src/nowiki/comment.js +0 -62
- package/dist/src/nowiki/dd.d.ts +0 -22
- package/dist/src/nowiki/dd.js +0 -47
- package/dist/src/nowiki/doubleUnderscore.d.ts +0 -37
- package/dist/src/nowiki/doubleUnderscore.js +0 -48
- package/dist/src/nowiki/hr.d.ts +0 -24
- package/dist/src/nowiki/hr.js +0 -29
- package/dist/src/nowiki/index.d.ts +0 -20
- package/dist/src/nowiki/index.js +0 -24
- package/dist/src/nowiki/list.d.ts +0 -16
- package/dist/src/nowiki/list.js +0 -14
- package/dist/src/nowiki/noinclude.d.ts +0 -21
- package/dist/src/nowiki/noinclude.js +0 -25
- package/dist/src/nowiki/quote.d.ts +0 -20
- package/dist/src/nowiki/quote.js +0 -66
- package/dist/src/onlyinclude.d.ts +0 -39
- package/dist/src/onlyinclude.js +0 -66
- package/dist/src/paramTag/index.d.ts +0 -52
- package/dist/src/paramTag/index.js +0 -78
- package/dist/src/paramTag/inputbox.d.ts +0 -8
- package/dist/src/paramTag/inputbox.js +0 -22
- package/dist/src/parameter.d.ts +0 -96
- package/dist/src/parameter.js +0 -203
- package/dist/src/pre.d.ts +0 -29
- package/dist/src/pre.js +0 -49
- package/dist/src/syntax.d.ts +0 -23
- package/dist/src/syntax.js +0 -67
- package/dist/src/table/base.d.ts +0 -61
- package/dist/src/table/base.js +0 -78
- package/dist/src/table/index.d.ts +0 -248
- package/dist/src/table/index.js +0 -782
- package/dist/src/table/td.d.ts +0 -121
- package/dist/src/table/td.js +0 -267
- package/dist/src/table/tr.d.ts +0 -32
- package/dist/src/table/tr.js +0 -51
- package/dist/src/table/trBase.d.ts +0 -62
- package/dist/src/table/trBase.js +0 -157
- package/dist/src/tagPair/ext.d.ts +0 -55
- package/dist/src/tagPair/ext.js +0 -138
- package/dist/src/tagPair/include.d.ts +0 -43
- package/dist/src/tagPair/include.js +0 -42
- package/dist/src/tagPair/index.d.ts +0 -57
- package/dist/src/tagPair/index.js +0 -107
- package/dist/src/transclude.d.ts +0 -201
- package/dist/src/transclude.js +0 -727
- package/dist/util/debug.js +0 -42
- package/dist/util/diff.js +0 -71
- package/dist/util/lint.js +0 -48
- package/dist/util/string.js +0 -75
- package/errors/README +0 -1
- package/printed/README +0 -1
package/dist/src/link/base.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { Token } from '..';
|
|
3
|
-
import { AtomToken } from '../atom';
|
|
4
|
-
import type { LintError } from '../../index';
|
|
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
|
-
type: 'link' | 'category' | 'file' | 'gallery-image' | 'imagemap-image';
|
|
13
|
-
name: string;
|
|
14
|
-
childNodes: [AtomToken, ...Token[]];
|
|
15
|
-
abstract get children(): [AtomToken, ...Token[]];
|
|
16
|
-
abstract get firstChild(): AtomToken;
|
|
17
|
-
abstract get firstElementChild(): AtomToken;
|
|
18
|
-
abstract get lastChild(): Token;
|
|
19
|
-
abstract get lastElementChild(): Token;
|
|
20
|
-
/** 完整链接 */
|
|
21
|
-
get link(): string | Title;
|
|
22
|
-
set link(link: string | Title);
|
|
23
|
-
/** fragment */
|
|
24
|
-
get fragment(): string | undefined;
|
|
25
|
-
/** 链接显示文字 */
|
|
26
|
-
get innerText(): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* @browser
|
|
29
|
-
* @param link 链接标题
|
|
30
|
-
* @param linkText 链接显示文字
|
|
31
|
-
* @param delimiter `|`
|
|
32
|
-
*/
|
|
33
|
-
constructor(link: string, linkText?: string, config?: Parser.Config, accum?: Token[], delimiter?: string);
|
|
34
|
-
/**
|
|
35
|
-
* @override
|
|
36
|
-
* @browser
|
|
37
|
-
*/
|
|
38
|
-
toString(omit?: Set<string>): string;
|
|
39
|
-
/**
|
|
40
|
-
* @override
|
|
41
|
-
* @browser
|
|
42
|
-
*/
|
|
43
|
-
text(): string;
|
|
44
|
-
/**
|
|
45
|
-
* @override
|
|
46
|
-
* @browser
|
|
47
|
-
*/
|
|
48
|
-
lint(start?: number): LintError[];
|
|
49
|
-
/**
|
|
50
|
-
* @override
|
|
51
|
-
* @browser
|
|
52
|
-
*/
|
|
53
|
-
print(): string;
|
|
54
|
-
/** @override */
|
|
55
|
-
cloneNode(this: this & {
|
|
56
|
-
constructor: new (...args: any[]) => unknown;
|
|
57
|
-
}): this;
|
|
58
|
-
/**
|
|
59
|
-
* 设置链接目标
|
|
60
|
-
* @param link 链接目标
|
|
61
|
-
* @throws `SyntaxError` 非法的链接目标
|
|
62
|
-
*/
|
|
63
|
-
setTarget(link: string | Title): void;
|
|
64
|
-
/**
|
|
65
|
-
* 设置链接显示文字
|
|
66
|
-
* @param linkStr 链接显示文字
|
|
67
|
-
* @throws `SyntaxError` 非法的链接显示文字
|
|
68
|
-
*/
|
|
69
|
-
setLinkText(linkStr?: string): void;
|
|
70
|
-
}
|
package/dist/src/link/base.js
DELETED
|
@@ -1,229 +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 string_1 = require("../../util/string");
|
|
6
|
-
const debug_1 = require("../../util/debug");
|
|
7
|
-
const Parser = require("../../index");
|
|
8
|
-
const __1 = require("..");
|
|
9
|
-
const atom_1 = require("../atom");
|
|
10
|
-
/**
|
|
11
|
-
* 内链
|
|
12
|
-
* @classdesc `{childNodes: [AtomToken, ...Token]}`
|
|
13
|
-
*/
|
|
14
|
-
class LinkBaseToken extends __1.Token {
|
|
15
|
-
#bracket = true;
|
|
16
|
-
#delimiter;
|
|
17
|
-
#fragment;
|
|
18
|
-
#encoded = false;
|
|
19
|
-
/** 完整链接 */
|
|
20
|
-
get link() {
|
|
21
|
-
return this.#getTitle();
|
|
22
|
-
}
|
|
23
|
-
set link(link) {
|
|
24
|
-
this.setTarget(link);
|
|
25
|
-
}
|
|
26
|
-
/** fragment */
|
|
27
|
-
get fragment() {
|
|
28
|
-
return this.#getTitle().fragment;
|
|
29
|
-
}
|
|
30
|
-
/** 链接显示文字 */
|
|
31
|
-
get innerText() {
|
|
32
|
-
if (this.type === 'link') {
|
|
33
|
-
return this.length > 1 ? this.lastChild.text() : this.firstChild.text().replace(/^\s*:/u, '');
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @browser
|
|
39
|
-
* @param link 链接标题
|
|
40
|
-
* @param linkText 链接显示文字
|
|
41
|
-
* @param delimiter `|`
|
|
42
|
-
*/
|
|
43
|
-
constructor(link, linkText, config = Parser.getConfig(), accum = [], delimiter = '|') {
|
|
44
|
-
super(undefined, config, true, accum, {
|
|
45
|
-
AtomToken: 0, Token: 1,
|
|
46
|
-
});
|
|
47
|
-
this.insertAt(new atom_1.AtomToken(link, 'link-target', config, accum, {
|
|
48
|
-
'Stage-2': ':', '!ExtToken': '', '!HeadingToken': '',
|
|
49
|
-
}));
|
|
50
|
-
if (linkText !== undefined) {
|
|
51
|
-
const inner = new __1.Token(linkText, config, true, accum, {
|
|
52
|
-
'Stage-5': ':', ConverterToken: ':',
|
|
53
|
-
});
|
|
54
|
-
inner.type = 'link-text';
|
|
55
|
-
this.insertAt(inner.setAttribute('stage', Parser.MAX_STAGE - 1));
|
|
56
|
-
}
|
|
57
|
-
this.#delimiter = delimiter;
|
|
58
|
-
this.protectChildren(0);
|
|
59
|
-
}
|
|
60
|
-
/** @private */
|
|
61
|
-
afterBuild() {
|
|
62
|
-
const titleObj = this.normalizeTitle(this.firstChild.text(), 0, false, true, true);
|
|
63
|
-
this.setAttribute('name', titleObj.title);
|
|
64
|
-
this.#fragment = titleObj.fragment;
|
|
65
|
-
this.#encoded = titleObj.encoded;
|
|
66
|
-
if (this.#delimiter.includes('\0')) {
|
|
67
|
-
this.#delimiter = this.buildFromStr(this.#delimiter, 'string');
|
|
68
|
-
}
|
|
69
|
-
const /** @implements */ linkListener = (e, data) => {
|
|
70
|
-
const { prevTarget } = e;
|
|
71
|
-
if (prevTarget?.type === 'link-target') {
|
|
72
|
-
const name = prevTarget.text(), { title, interwiki, ns, valid, fragment, encoded } = this.normalizeTitle(name, 0, false, true, true);
|
|
73
|
-
if (!valid) {
|
|
74
|
-
(0, debug_1.undo)(e, data);
|
|
75
|
-
throw new Error(`非法的内链目标:${name}`);
|
|
76
|
-
}
|
|
77
|
-
else if (this.type === 'category' && (interwiki || ns !== 14)
|
|
78
|
-
|| this.type === 'file' && (interwiki || ns !== 6)) {
|
|
79
|
-
(0, debug_1.undo)(e, data);
|
|
80
|
-
throw new Error(`${this.type === 'file' ? '文件' : '分类'}链接不可更改命名空间:${name}`);
|
|
81
|
-
}
|
|
82
|
-
else if (this.type === 'link' && !interwiki && (ns === 6 || ns === 14)
|
|
83
|
-
&& !name.trim().startsWith(':')) {
|
|
84
|
-
const { firstChild } = prevTarget;
|
|
85
|
-
if (firstChild?.type === 'text') {
|
|
86
|
-
firstChild.insertData(0, ':');
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
prevTarget.prepend(':');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
this.setAttribute('name', title);
|
|
93
|
-
this.#fragment = fragment;
|
|
94
|
-
this.#encoded = encoded;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
this.addEventListener(['remove', 'insert', 'replace', 'text'], linkListener);
|
|
98
|
-
}
|
|
99
|
-
/** @private */
|
|
100
|
-
setAttribute(key, value) {
|
|
101
|
-
if (key === 'bracket') {
|
|
102
|
-
this.#bracket = Boolean(value);
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
return super.setAttribute(key, value);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @override
|
|
109
|
-
* @browser
|
|
110
|
-
*/
|
|
111
|
-
toString(omit) {
|
|
112
|
-
const str = super.toString(omit, this.#delimiter);
|
|
113
|
-
return this.#bracket && !(omit && this.matchesTypes(omit)) ? `[[${str}]]` : str;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* @override
|
|
117
|
-
* @browser
|
|
118
|
-
*/
|
|
119
|
-
text() {
|
|
120
|
-
const str = super.text('|');
|
|
121
|
-
return this.#bracket ? `[[${str}]]` : str;
|
|
122
|
-
}
|
|
123
|
-
/** @private */
|
|
124
|
-
getPadding() {
|
|
125
|
-
return 2;
|
|
126
|
-
}
|
|
127
|
-
/** @private */
|
|
128
|
-
getGaps(i) {
|
|
129
|
-
if (i >= this.length - 1) {
|
|
130
|
-
return 0;
|
|
131
|
-
}
|
|
132
|
-
return i === 0 ? this.#delimiter.length : 1;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @override
|
|
136
|
-
* @browser
|
|
137
|
-
*/
|
|
138
|
-
lint(start = this.getAbsoluteIndex()) {
|
|
139
|
-
const errors = super.lint(start), { childNodes: [target, linkText], type: linkType } = this;
|
|
140
|
-
let rect;
|
|
141
|
-
if (linkType === 'link' && target.childNodes.some(({ type }) => type === 'template')) {
|
|
142
|
-
rect = { start, ...this.getRootNode().posFromIndex(start) };
|
|
143
|
-
errors.push((0, lint_1.generateForChild)(target, rect, 'template in an internal link target', 'warning'));
|
|
144
|
-
}
|
|
145
|
-
if (this.#encoded) {
|
|
146
|
-
rect ??= { start, ...this.getRootNode().posFromIndex(start) };
|
|
147
|
-
errors.push((0, lint_1.generateForChild)(target, rect, 'unnecessary URL encoding in an internal link'));
|
|
148
|
-
}
|
|
149
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
150
|
-
if (linkType === 'link' && linkText?.childNodes?.some(child => child.type === 'text' && child.data.includes('|'))) {
|
|
151
|
-
rect ??= { start, ...this.getRootNode().posFromIndex(start) };
|
|
152
|
-
errors.push((0, lint_1.generateForChild)(linkText, rect, 'additional "|" in the link text', 'warning'));
|
|
153
|
-
}
|
|
154
|
-
else if (linkType !== 'link' && this.#fragment !== undefined) {
|
|
155
|
-
rect ??= { start, ...this.getRootNode().posFromIndex(start) };
|
|
156
|
-
errors.push((0, lint_1.generateForChild)(target, rect, 'useless fragment'));
|
|
157
|
-
}
|
|
158
|
-
return errors;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @override
|
|
162
|
-
* @browser
|
|
163
|
-
*/
|
|
164
|
-
print() {
|
|
165
|
-
return super.print(this.#bracket ? { pre: '[[', post: ']]', sep: this.#delimiter } : { sep: this.#delimiter });
|
|
166
|
-
}
|
|
167
|
-
/** 生成Title对象 */
|
|
168
|
-
#getTitle() {
|
|
169
|
-
return this.normalizeTitle(this.firstChild.text(), 0, false, true, true);
|
|
170
|
-
}
|
|
171
|
-
/** @override */
|
|
172
|
-
cloneNode() {
|
|
173
|
-
const [link, ...linkText] = this.cloneChildNodes();
|
|
174
|
-
return Parser.run(() => {
|
|
175
|
-
const token = new this.constructor('', undefined, this.getAttribute('config'));
|
|
176
|
-
token.firstChild.safeReplaceWith(link);
|
|
177
|
-
token.append(...linkText);
|
|
178
|
-
token.afterBuild();
|
|
179
|
-
return token;
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* 设置链接目标
|
|
184
|
-
* @param link 链接目标
|
|
185
|
-
* @throws `SyntaxError` 非法的链接目标
|
|
186
|
-
*/
|
|
187
|
-
setTarget(link) {
|
|
188
|
-
let strLink = String(link);
|
|
189
|
-
if (this.type === 'link' && !/^\s*[:#]/u.test(strLink)) {
|
|
190
|
-
strLink = `:${strLink}`;
|
|
191
|
-
}
|
|
192
|
-
const root = Parser.parse(`[[${strLink}]]`, this.getAttribute('include'), 6, this.getAttribute('config')), { length, firstChild: wikiLink } = root;
|
|
193
|
-
if (length !== 1 || wikiLink?.type !== this.type || wikiLink.length !== 1) {
|
|
194
|
-
const msgs = { link: '内链', file: '文件链接', category: '分类' };
|
|
195
|
-
throw new SyntaxError(`非法的${msgs[this.type]}目标:${strLink}`);
|
|
196
|
-
}
|
|
197
|
-
const { firstChild } = wikiLink;
|
|
198
|
-
wikiLink.destroy();
|
|
199
|
-
this.firstChild.safeReplaceWith(firstChild);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* 设置链接显示文字
|
|
203
|
-
* @param linkStr 链接显示文字
|
|
204
|
-
* @throws `SyntaxError` 非法的链接显示文字
|
|
205
|
-
*/
|
|
206
|
-
setLinkText(linkStr) {
|
|
207
|
-
let lastChild;
|
|
208
|
-
const config = this.getAttribute('config');
|
|
209
|
-
if (linkStr) {
|
|
210
|
-
const root = Parser.parse(`[[${this.type === 'category' ? 'Category:' : ''}L|${linkStr}]]`, this.getAttribute('include'), 6, config), { length, firstChild: wikiLink } = root;
|
|
211
|
-
if (length !== 1 || wikiLink?.type !== this.type || wikiLink.length !== 2) {
|
|
212
|
-
throw new SyntaxError(`非法的${this.type === 'link' ? '内链文字' : '分类关键字'}:${(0, string_1.noWrap)(linkStr)}`);
|
|
213
|
-
}
|
|
214
|
-
({ lastChild } = wikiLink);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
lastChild = Parser.run(() => new __1.Token('', config, true));
|
|
218
|
-
lastChild.setAttribute('stage', 7).type = 'link-text';
|
|
219
|
-
}
|
|
220
|
-
if (this.length === 1) {
|
|
221
|
-
this.insertAt(lastChild);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
this.lastChild.safeReplaceWith(lastChild);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
exports.LinkBaseToken = LinkBaseToken;
|
|
229
|
-
Parser.classes['LinkBaseToken'] = __filename;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LinkToken } from '.';
|
|
2
|
-
/** 分类 */
|
|
3
|
-
export declare class CategoryToken extends LinkToken {
|
|
4
|
-
/** @browser */
|
|
5
|
-
readonly type = "category";
|
|
6
|
-
/** 分类排序关键字 */
|
|
7
|
-
get sortkey(): string | undefined;
|
|
8
|
-
set sortkey(text: string | undefined);
|
|
9
|
-
/**
|
|
10
|
-
* 设置排序关键字
|
|
11
|
-
* @param text 排序关键字
|
|
12
|
-
*/
|
|
13
|
-
setSortkey(text?: string): void;
|
|
14
|
-
}
|
|
@@ -1,29 +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 Parser = require("../../index");
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
/** 分类 */
|
|
8
|
-
// @ts-expect-error not implementing all abstract methods
|
|
9
|
-
class CategoryToken extends _1.LinkToken {
|
|
10
|
-
/** @browser */
|
|
11
|
-
type = 'category';
|
|
12
|
-
/** 分类排序关键字 */
|
|
13
|
-
get sortkey() {
|
|
14
|
-
const { childNodes: [, child] } = this;
|
|
15
|
-
return child && (0, string_1.decodeHtml)(child.text());
|
|
16
|
-
}
|
|
17
|
-
set sortkey(text) {
|
|
18
|
-
this.setSortkey(text);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 设置排序关键字
|
|
22
|
-
* @param text 排序关键字
|
|
23
|
-
*/
|
|
24
|
-
setSortkey(text) {
|
|
25
|
-
this.setLinkText(text);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.CategoryToken = CategoryToken;
|
|
29
|
-
Parser.classes['CategoryToken'] = __filename;
|
package/dist/src/link/file.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { LinkBaseToken } from './base';
|
|
3
|
-
import { ImageParameterToken } from '../imageParameter';
|
|
4
|
-
import type { Title } from '../../lib/title';
|
|
5
|
-
import type { LintError } from '../../index';
|
|
6
|
-
import type { Token, AtomToken } from '../../internal';
|
|
7
|
-
/**
|
|
8
|
-
* 图片
|
|
9
|
-
* @classdesc `{childNodes: [AtomToken, ...ImageParameterToken]}`
|
|
10
|
-
*/
|
|
11
|
-
export declare class FileToken extends LinkBaseToken {
|
|
12
|
-
#private;
|
|
13
|
-
/** @browser */
|
|
14
|
-
readonly type: 'file' | 'gallery-image' | 'imagemap-image';
|
|
15
|
-
childNodes: [AtomToken, ...ImageParameterToken[]];
|
|
16
|
-
abstract get children(): [AtomToken, ...ImageParameterToken[]];
|
|
17
|
-
abstract get lastChild(): AtomToken | ImageParameterToken;
|
|
18
|
-
abstract get lastElementChild(): AtomToken | ImageParameterToken;
|
|
19
|
-
/** 图片链接 */
|
|
20
|
-
get link(): string | Title;
|
|
21
|
-
set link(value: string | Title);
|
|
22
|
-
/** 图片大小 */
|
|
23
|
-
get size(): {
|
|
24
|
-
width: string;
|
|
25
|
-
height: string;
|
|
26
|
-
} | undefined;
|
|
27
|
-
/** 图片宽度 */
|
|
28
|
-
get width(): string | undefined;
|
|
29
|
-
set width(width: string | undefined);
|
|
30
|
-
/** 图片高度 */
|
|
31
|
-
get height(): string | undefined;
|
|
32
|
-
set height(height: string | undefined);
|
|
33
|
-
/**
|
|
34
|
-
* @browser
|
|
35
|
-
* @param link 文件名
|
|
36
|
-
* @param text 图片参数
|
|
37
|
-
* @param delimiter `|`
|
|
38
|
-
*/
|
|
39
|
-
constructor(link: string, text?: string, config?: Parser.Config, accum?: Token[], delimiter?: string);
|
|
40
|
-
/**
|
|
41
|
-
* @override
|
|
42
|
-
* @browser
|
|
43
|
-
*/
|
|
44
|
-
lint(start?: number): LintError[];
|
|
45
|
-
/**
|
|
46
|
-
* 获取所有图片参数节点
|
|
47
|
-
* @browser
|
|
48
|
-
*/
|
|
49
|
-
getAllArgs(): ImageParameterToken[];
|
|
50
|
-
/**
|
|
51
|
-
* 获取指定图片参数
|
|
52
|
-
* @browser
|
|
53
|
-
* @param key 参数名
|
|
54
|
-
*/
|
|
55
|
-
getArgs(key: string): ImageParameterToken[];
|
|
56
|
-
/**
|
|
57
|
-
* 获取图片框架属性参数节点
|
|
58
|
-
* @browser
|
|
59
|
-
*/
|
|
60
|
-
getFrameArgs(): ImageParameterToken[];
|
|
61
|
-
/**
|
|
62
|
-
* 获取图片水平对齐参数节点
|
|
63
|
-
* @browser
|
|
64
|
-
*/
|
|
65
|
-
getHorizAlignArgs(): ImageParameterToken[];
|
|
66
|
-
/**
|
|
67
|
-
* 获取图片垂直对齐参数节点
|
|
68
|
-
* @browser
|
|
69
|
-
*/
|
|
70
|
-
getVertAlignArgs(): ImageParameterToken[];
|
|
71
|
-
/**
|
|
72
|
-
* 获取生效的指定图片参数
|
|
73
|
-
* @param key 参数名
|
|
74
|
-
*/
|
|
75
|
-
getArg(key: string): ImageParameterToken | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* 是否具有指定图片参数
|
|
78
|
-
* @param key 参数名
|
|
79
|
-
*/
|
|
80
|
-
hasArg(key: string): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* 移除指定图片参数
|
|
83
|
-
* @param key 参数名
|
|
84
|
-
*/
|
|
85
|
-
removeArg(key: string): void;
|
|
86
|
-
/** 获取图片参数名 */
|
|
87
|
-
getKeys(): Set<string>;
|
|
88
|
-
/**
|
|
89
|
-
* 获取指定的图片参数值
|
|
90
|
-
* @param key 参数名
|
|
91
|
-
*/
|
|
92
|
-
getValues(key: string): (string | true)[];
|
|
93
|
-
/**
|
|
94
|
-
* 获取生效的指定图片参数值
|
|
95
|
-
* @param key 参数名
|
|
96
|
-
*/
|
|
97
|
-
getValue(key: string): string | true | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* 设置图片参数
|
|
100
|
-
* @param key 参数名
|
|
101
|
-
* @param value 参数值
|
|
102
|
-
* @throws `RangeError` 未定义的图片参数
|
|
103
|
-
* @throws `SyntaxError` 非法的参数
|
|
104
|
-
*/
|
|
105
|
-
setValue(key: string, value?: string | boolean): void;
|
|
106
|
-
}
|