wikiparser-node 1.0.0-beta.5 → 1.0.2-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/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 +70 -0
- package/extensions/dist/editor.js +172 -0
- package/extensions/dist/highlight.js +39 -0
- package/extensions/dist/lint.js +48 -0
- package/extensions/editor.css +63 -0
- package/extensions/ui.css +119 -0
- package/package.json +24 -12
- package/config/.schema.json +0 -160
- package/dist/bin/toc.js +0 -18
- package/dist/index.d.ts +0 -58
- package/dist/index.js +0 -313
- package/dist/internal.d.ts +0 -44
- package/dist/lib/element.d.ts +0 -167
- package/dist/lib/element.js +0 -659
- package/dist/lib/node.d.ts +0 -147
- package/dist/lib/node.js +0 -428
- package/dist/lib/range.d.ts +0 -139
- package/dist/lib/range.js +0 -412
- package/dist/lib/ranges.d.ts +0 -28
- package/dist/lib/ranges.js +0 -123
- package/dist/lib/text.d.ts +0 -63
- package/dist/lib/text.js +0 -216
- package/dist/lib/title.d.ts +0 -20
- package/dist/lib/title.js +0 -108
- package/dist/mixin/attributesParent.js +0 -92
- package/dist/mixin/fixed.js +0 -31
- package/dist/mixin/hidden.js +0 -22
- package/dist/mixin/singleLine.js +0 -25
- package/dist/mixin/sol.js +0 -43
- package/dist/mixin/syntax.js +0 -55
- 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 -161
- package/dist/parser/table.js +0 -109
- package/dist/src/arg.d.ts +0 -58
- package/dist/src/arg.js +0 -186
- package/dist/src/atom.d.ts +0 -12
- package/dist/src/atom.js +0 -25
- package/dist/src/attribute.d.ts +0 -86
- package/dist/src/attribute.js +0 -417
- package/dist/src/attributes.d.ts +0 -108
- package/dist/src/attributes.js +0 -354
- package/dist/src/converter.d.ts +0 -63
- package/dist/src/converter.js +0 -126
- package/dist/src/converterFlags.d.ts +0 -84
- package/dist/src/converterFlags.js +0 -210
- package/dist/src/converterRule.d.ts +0 -84
- package/dist/src/converterRule.js +0 -244
- package/dist/src/extLink.d.ts +0 -51
- package/dist/src/extLink.js +0 -148
- package/dist/src/gallery.d.ts +0 -54
- package/dist/src/gallery.js +0 -119
- package/dist/src/heading.d.ts +0 -73
- package/dist/src/heading.js +0 -115
- package/dist/src/hidden.d.ts +0 -21
- package/dist/src/hidden.js +0 -22
- package/dist/src/html.d.ts +0 -100
- package/dist/src/html.js +0 -229
- package/dist/src/imageParameter.d.ts +0 -63
- package/dist/src/imageParameter.js +0 -246
- package/dist/src/imagemap.d.ts +0 -57
- package/dist/src/imagemap.js +0 -144
- package/dist/src/imagemapLink.d.ts +0 -57
- package/dist/src/imagemapLink.js +0 -39
- package/dist/src/index.d.ts +0 -148
- package/dist/src/index.js +0 -783
- package/dist/src/link/base.d.ts +0 -55
- package/dist/src/link/base.js +0 -221
- package/dist/src/link/category.d.ts +0 -13
- package/dist/src/link/category.js +0 -29
- package/dist/src/link/file.d.ts +0 -88
- package/dist/src/link/file.js +0 -251
- package/dist/src/link/galleryImage.d.ts +0 -47
- package/dist/src/link/galleryImage.js +0 -114
- package/dist/src/link/index.d.ts +0 -49
- package/dist/src/link/index.js +0 -136
- package/dist/src/magicLink.d.ts +0 -62
- package/dist/src/magicLink.js +0 -130
- package/dist/src/nested.d.ts +0 -44
- package/dist/src/nested.js +0 -85
- package/dist/src/nowiki/base.d.ts +0 -44
- package/dist/src/nowiki/base.js +0 -36
- package/dist/src/nowiki/comment.d.ts +0 -34
- package/dist/src/nowiki/comment.js +0 -52
- package/dist/src/nowiki/dd.d.ts +0 -5
- package/dist/src/nowiki/dd.js +0 -18
- package/dist/src/nowiki/doubleUnderscore.d.ts +0 -47
- package/dist/src/nowiki/doubleUnderscore.js +0 -49
- package/dist/src/nowiki/hr.d.ts +0 -32
- package/dist/src/nowiki/hr.js +0 -14
- package/dist/src/nowiki/index.d.ts +0 -16
- package/dist/src/nowiki/index.js +0 -20
- package/dist/src/nowiki/list.d.ts +0 -24
- package/dist/src/nowiki/list.js +0 -31
- package/dist/src/nowiki/listBase.d.ts +0 -29
- package/dist/src/nowiki/listBase.js +0 -34
- package/dist/src/nowiki/noinclude.d.ts +0 -26
- package/dist/src/nowiki/noinclude.js +0 -25
- package/dist/src/nowiki/quote.d.ts +0 -22
- package/dist/src/nowiki/quote.js +0 -48
- package/dist/src/onlyinclude.d.ts +0 -14
- package/dist/src/onlyinclude.js +0 -49
- package/dist/src/paramTag/index.d.ts +0 -37
- package/dist/src/paramTag/index.js +0 -66
- package/dist/src/paramTag/inputbox.d.ts +0 -8
- package/dist/src/paramTag/inputbox.js +0 -22
- package/dist/src/parameter.d.ts +0 -82
- package/dist/src/parameter.js +0 -190
- package/dist/src/pre.d.ts +0 -28
- package/dist/src/pre.js +0 -49
- package/dist/src/syntax.d.ts +0 -24
- package/dist/src/syntax.js +0 -28
- package/dist/src/table/base.d.ts +0 -59
- package/dist/src/table/base.js +0 -80
- package/dist/src/table/index.d.ts +0 -239
- package/dist/src/table/index.js +0 -776
- package/dist/src/table/td.d.ts +0 -106
- package/dist/src/table/td.js +0 -256
- package/dist/src/table/tr.d.ts +0 -30
- package/dist/src/table/tr.js +0 -50
- package/dist/src/table/trBase.d.ts +0 -54
- package/dist/src/table/trBase.js +0 -151
- package/dist/src/tagPair/ext.d.ts +0 -56
- package/dist/src/tagPair/ext.js +0 -138
- package/dist/src/tagPair/include.d.ts +0 -46
- package/dist/src/tagPair/include.js +0 -41
- package/dist/src/tagPair/index.d.ts +0 -47
- package/dist/src/tagPair/index.js +0 -94
- package/dist/src/transclude.d.ts +0 -171
- package/dist/src/transclude.js +0 -697
- package/dist/util/debug.js +0 -42
- package/dist/util/diff.js +0 -72
- package/dist/util/lint.js +0 -48
- package/dist/util/string.js +0 -70
- package/errors/README +0 -1
- package/printed/README +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { Token } from '../index';
|
|
3
|
-
import type { AstText } from '../../lib/text';
|
|
4
|
-
declare type NowikiTypes = 'ext-inner' | 'comment' | 'dd' | 'double-underscore' | 'hr' | 'list' | 'noinclude' | 'quote';
|
|
5
|
-
declare const NowikiBaseToken_base: ((abstract new (...args: any[]) => {
|
|
6
|
-
removeAt(): never;
|
|
7
|
-
insertAt(token: string, i?: number | undefined): Parser.AstText;
|
|
8
|
-
insertAt<T extends Parser.AstNodes>(token: T, i?: number | undefined): T;
|
|
9
|
-
length: number;
|
|
10
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
11
|
-
text(separator?: string | undefined): string;
|
|
12
|
-
afterBuild(): void;
|
|
13
|
-
getAttribute<T_1 extends string>(key: T_1): TokenAttributeGetter<T_1>;
|
|
14
|
-
setAttribute<T_2 extends string>(key: T_2, value: TokenAttributeSetter<T_2>): void;
|
|
15
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
16
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
17
|
-
}) & {
|
|
18
|
-
readonly fixed: true;
|
|
19
|
-
}) & typeof Parser.Token;
|
|
20
|
-
/**
|
|
21
|
-
* 纯文字Token,不会被解析
|
|
22
|
-
* @classdesc `{childNodes: [AstText]}`
|
|
23
|
-
*/
|
|
24
|
-
export declare abstract class NowikiBaseToken extends NowikiBaseToken_base {
|
|
25
|
-
type: NowikiTypes;
|
|
26
|
-
childNodes: [AstText];
|
|
27
|
-
abstract get children(): [];
|
|
28
|
-
abstract get firstChild(): AstText;
|
|
29
|
-
abstract get firstElementChild(): undefined;
|
|
30
|
-
abstract get lastChild(): AstText;
|
|
31
|
-
abstract get lastElementChild(): undefined;
|
|
32
|
-
/** @param wikitext default: `''` */
|
|
33
|
-
constructor(wikitext?: string, config?: Parser.Config, accum?: Token[]);
|
|
34
|
-
/** @override */
|
|
35
|
-
cloneNode(this: this & {
|
|
36
|
-
constructor: new (...args: any[]) => unknown;
|
|
37
|
-
}): this;
|
|
38
|
-
/**
|
|
39
|
-
* @override
|
|
40
|
-
* @param str 新文本
|
|
41
|
-
*/
|
|
42
|
-
setText(str: string): string;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
package/dist/src/nowiki/base.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NowikiBaseToken = void 0;
|
|
4
|
-
const fixed_1 = require("../../mixin/fixed");
|
|
5
|
-
const Parser = require("../../index");
|
|
6
|
-
const index_1 = require("../index");
|
|
7
|
-
/**
|
|
8
|
-
* 纯文字Token,不会被解析
|
|
9
|
-
* @classdesc `{childNodes: [AstText]}`
|
|
10
|
-
*/
|
|
11
|
-
class NowikiBaseToken extends (0, fixed_1.fixed)(index_1.Token) {
|
|
12
|
-
/** @param wikitext default: `''` */
|
|
13
|
-
constructor(wikitext = '', config = Parser.getConfig(), accum = []) {
|
|
14
|
-
super(wikitext, config, accum);
|
|
15
|
-
}
|
|
16
|
-
/* NOT FOR BROWSER */
|
|
17
|
-
/** @override */
|
|
18
|
-
cloneNode() {
|
|
19
|
-
const { constructor, firstChild: { data }, type } = this;
|
|
20
|
-
return Parser.run(() => {
|
|
21
|
-
const token = new constructor(data, this.getAttribute('config'));
|
|
22
|
-
token.type = type;
|
|
23
|
-
token.afterBuild();
|
|
24
|
-
return token;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @override
|
|
29
|
-
* @param str 新文本
|
|
30
|
-
*/
|
|
31
|
-
setText(str) {
|
|
32
|
-
return super.setText(str, 0);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.NowikiBaseToken = NowikiBaseToken;
|
|
36
|
-
Parser.classes['NowikiBaseToken'] = __filename;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
import type { LintError } from '../../index';
|
|
4
|
-
import type { Token } from '../index';
|
|
5
|
-
declare const CommentToken_base: ((abstract new (...args: any[]) => {
|
|
6
|
-
text(): string;
|
|
7
|
-
length: number;
|
|
8
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
9
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
10
|
-
/** @param closed 是否闭合 */
|
|
11
|
-
afterBuild(): void;
|
|
12
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
13
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
14
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
15
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
16
|
-
}) & {
|
|
17
|
-
readonly hidden: true;
|
|
18
|
-
}) & typeof NowikiBaseToken;
|
|
19
|
-
/** HTML注释,不可见 */
|
|
20
|
-
export declare class CommentToken extends CommentToken_base {
|
|
21
|
-
readonly type = "comment";
|
|
22
|
-
closed: boolean;
|
|
23
|
-
/** 内部wikitext */
|
|
24
|
-
get innerText(): string;
|
|
25
|
-
/** @param closed 是否闭合 */
|
|
26
|
-
constructor(wikitext: string, closed?: boolean, config?: Parser.Config, accum?: Token[]);
|
|
27
|
-
/** @override */
|
|
28
|
-
lint(start?: number): LintError[];
|
|
29
|
-
/** @override */
|
|
30
|
-
print(): string;
|
|
31
|
-
/** @override */
|
|
32
|
-
cloneNode(): this;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommentToken = void 0;
|
|
4
|
-
const lint_1 = require("../../util/lint");
|
|
5
|
-
const hidden_1 = require("../../mixin/hidden");
|
|
6
|
-
const Parser = require("../../index");
|
|
7
|
-
const base_1 = require("./base");
|
|
8
|
-
/** HTML注释,不可见 */
|
|
9
|
-
// @ts-expect-error not implementing all abstract methods
|
|
10
|
-
class CommentToken extends (0, hidden_1.hidden)(base_1.NowikiBaseToken) {
|
|
11
|
-
type = 'comment';
|
|
12
|
-
closed;
|
|
13
|
-
/* NOT FOR BROWSER */
|
|
14
|
-
/** 内部wikitext */
|
|
15
|
-
get innerText() {
|
|
16
|
-
return this.firstChild.data;
|
|
17
|
-
}
|
|
18
|
-
/* NOT FOR BROWSER END */
|
|
19
|
-
/** @param closed 是否闭合 */
|
|
20
|
-
constructor(wikitext, closed = true, config = Parser.getConfig(), accum = []) {
|
|
21
|
-
super(wikitext, config, accum);
|
|
22
|
-
this.closed = closed;
|
|
23
|
-
Object.defineProperty(this, 'closed', { enumerable: false });
|
|
24
|
-
}
|
|
25
|
-
/** @private */
|
|
26
|
-
getPadding() {
|
|
27
|
-
return 4;
|
|
28
|
-
}
|
|
29
|
-
/** @override */
|
|
30
|
-
lint(start = this.getAbsoluteIndex()) {
|
|
31
|
-
return this.closed ? [] : [(0, lint_1.generateForSelf)(this, { start }, 'unclosed HTML comment')];
|
|
32
|
-
}
|
|
33
|
-
/** @private */
|
|
34
|
-
toString(omit) {
|
|
35
|
-
if (!this.closed && this.nextSibling) {
|
|
36
|
-
Parser.error('自动闭合HTML注释', this);
|
|
37
|
-
this.closed = true;
|
|
38
|
-
}
|
|
39
|
-
return omit && this.matchesTypes(omit) ? '' : `<!--${this.firstChild.data}${this.closed ? '-->' : ''}`;
|
|
40
|
-
}
|
|
41
|
-
/** @override */
|
|
42
|
-
print() {
|
|
43
|
-
return super.print({ pre: '<!--', post: this.closed ? '-->' : '' });
|
|
44
|
-
}
|
|
45
|
-
/* NOT FOR BROWSER */
|
|
46
|
-
/** @override */
|
|
47
|
-
cloneNode() {
|
|
48
|
-
return Parser.run(() => new CommentToken(this.firstChild.data, this.closed, this.getAttribute('config')));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.CommentToken = CommentToken;
|
|
52
|
-
Parser.classes['CommentToken'] = __filename;
|
package/dist/src/nowiki/dd.d.ts
DELETED
package/dist/src/nowiki/dd.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DdToken = void 0;
|
|
4
|
-
const Parser = require("../../index");
|
|
5
|
-
const listBase_1 = require("./listBase");
|
|
6
|
-
/** `:` */
|
|
7
|
-
// @ts-expect-error not implementing all abstract methods
|
|
8
|
-
class DdToken extends listBase_1.ListBaseToken {
|
|
9
|
-
type = 'dd';
|
|
10
|
-
/* NOT FOR BROWSER */
|
|
11
|
-
/** @private */
|
|
12
|
-
afterBuild() {
|
|
13
|
-
this.setAttribute('pattern', /^:+$/u);
|
|
14
|
-
super.afterBuild();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.DdToken = DdToken;
|
|
18
|
-
Parser.classes['DdToken'] = __filename;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
import type { Token } from '../index';
|
|
4
|
-
declare const DoubleUnderscoreToken_base: (abstract new (...args: any[]) => {
|
|
5
|
-
"__#8@#pattern": RegExp;
|
|
6
|
-
afterBuild(): void;
|
|
7
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
8
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
9
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
10
|
-
length: number;
|
|
11
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
12
|
-
/**
|
|
13
|
-
* @param word 状态开关名
|
|
14
|
-
* @param fixed 是否固定大小写
|
|
15
|
-
*/
|
|
16
|
-
text(separator?: string | undefined): string;
|
|
17
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
18
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
19
|
-
}) & ((abstract new (...args: any[]) => {
|
|
20
|
-
text(): string;
|
|
21
|
-
length: number;
|
|
22
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
23
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
24
|
-
afterBuild(): void;
|
|
25
|
-
getAttribute<T_2 extends string>(key: T_2): TokenAttributeGetter<T_2>;
|
|
26
|
-
setAttribute<T_3 extends string>(key: T_3, value: TokenAttributeSetter<T_3>): void;
|
|
27
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
28
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
29
|
-
}) & {
|
|
30
|
-
readonly hidden: true;
|
|
31
|
-
}) & typeof NowikiBaseToken;
|
|
32
|
-
/** 状态开关 */
|
|
33
|
-
export declare class DoubleUnderscoreToken extends DoubleUnderscoreToken_base {
|
|
34
|
-
#private;
|
|
35
|
-
readonly type = "double-underscore";
|
|
36
|
-
name: string;
|
|
37
|
-
/**
|
|
38
|
-
* @param word 状态开关名
|
|
39
|
-
* @param fixed 是否固定大小写
|
|
40
|
-
*/
|
|
41
|
-
constructor(word: string, fixed: boolean, config?: Parser.Config, accum?: Token[]);
|
|
42
|
-
/** @override */
|
|
43
|
-
print(): string;
|
|
44
|
-
/** @override */
|
|
45
|
-
cloneNode(): this;
|
|
46
|
-
}
|
|
47
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DoubleUnderscoreToken = void 0;
|
|
4
|
-
const hidden_1 = require("../../mixin/hidden");
|
|
5
|
-
const syntax_1 = require("../../mixin/syntax");
|
|
6
|
-
const Parser = require("../../index");
|
|
7
|
-
const base_1 = require("./base");
|
|
8
|
-
/** 状态开关 */
|
|
9
|
-
// @ts-expect-error not implementing all abstract methods
|
|
10
|
-
class DoubleUnderscoreToken extends (0, syntax_1.syntax)((0, hidden_1.hidden)(base_1.NowikiBaseToken)) {
|
|
11
|
-
type = 'double-underscore';
|
|
12
|
-
/* NOT FOR BROWSER */
|
|
13
|
-
#fixed;
|
|
14
|
-
/* NOT FOR BROWSER END */
|
|
15
|
-
/**
|
|
16
|
-
* @param word 状态开关名
|
|
17
|
-
* @param fixed 是否固定大小写
|
|
18
|
-
*/
|
|
19
|
-
constructor(word, fixed, config = Parser.getConfig(), accum = []) {
|
|
20
|
-
super(word, config, accum);
|
|
21
|
-
this.#fixed = fixed;
|
|
22
|
-
this.setAttribute('name', word.toLowerCase());
|
|
23
|
-
this.setAttribute('pattern', new RegExp(`^${word}$`, fixed ? 'u' : 'iu'));
|
|
24
|
-
}
|
|
25
|
-
/** @private */
|
|
26
|
-
getPadding() {
|
|
27
|
-
return 2;
|
|
28
|
-
}
|
|
29
|
-
/** @private */
|
|
30
|
-
toString(omit) {
|
|
31
|
-
return omit && this.matchesTypes(omit) ? '' : `__${this.firstChild.data}__`;
|
|
32
|
-
}
|
|
33
|
-
/** @override */
|
|
34
|
-
print() {
|
|
35
|
-
return super.print({ pre: '__', post: '__' });
|
|
36
|
-
}
|
|
37
|
-
/* NOT FOR BROWSER */
|
|
38
|
-
/** @override */
|
|
39
|
-
cloneNode() {
|
|
40
|
-
const config = this.getAttribute('config');
|
|
41
|
-
return Parser.run(() => {
|
|
42
|
-
const token = new DoubleUnderscoreToken(this.firstChild.data, this.#fixed, config);
|
|
43
|
-
token.afterBuild();
|
|
44
|
-
return token;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.DoubleUnderscoreToken = DoubleUnderscoreToken;
|
|
49
|
-
Parser.classes['DoubleUnderscoreToken'] = __filename;
|
package/dist/src/nowiki/hr.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
declare const HrToken_base: (abstract new (...args: any[]) => {
|
|
4
|
-
"__#8@#pattern": RegExp;
|
|
5
|
-
afterBuild(): void;
|
|
6
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
7
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
8
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
9
|
-
length: number;
|
|
10
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
11
|
-
text(separator?: string | undefined): string;
|
|
12
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
13
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
14
|
-
}) & (abstract new (...args: any[]) => {
|
|
15
|
-
"__#7@#isRoot"(): boolean;
|
|
16
|
-
prependNewLine(): string;
|
|
17
|
-
toString(omit?: Set<string> | undefined): string;
|
|
18
|
-
getPadding(): number;
|
|
19
|
-
text(): string;
|
|
20
|
-
length: number;
|
|
21
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
22
|
-
afterBuild(): void;
|
|
23
|
-
getAttribute<T_2 extends string>(key: T_2): TokenAttributeGetter<T_2>;
|
|
24
|
-
setAttribute<T_3 extends string>(key: T_3, value: TokenAttributeSetter<T_3>): void;
|
|
25
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
26
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
27
|
-
}) & typeof NowikiBaseToken;
|
|
28
|
-
/** `<hr>` */
|
|
29
|
-
export declare class HrToken extends HrToken_base {
|
|
30
|
-
readonly type = "hr";
|
|
31
|
-
}
|
|
32
|
-
export {};
|
package/dist/src/nowiki/hr.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HrToken = void 0;
|
|
4
|
-
const sol_1 = require("../../mixin/sol");
|
|
5
|
-
const syntax_1 = require("../../mixin/syntax");
|
|
6
|
-
const Parser = require("../../index");
|
|
7
|
-
const base_1 = require("./base");
|
|
8
|
-
/** `<hr>` */
|
|
9
|
-
// @ts-expect-error not implementing all abstract methods
|
|
10
|
-
class HrToken extends (0, syntax_1.syntax)((0, sol_1.sol)(base_1.NowikiBaseToken), /^-{4,}$/u) {
|
|
11
|
-
type = 'hr';
|
|
12
|
-
}
|
|
13
|
-
exports.HrToken = HrToken;
|
|
14
|
-
Parser.classes['HrToken'] = __filename;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NowikiBaseToken } from './base';
|
|
2
|
-
import type { LintError } from '../../index';
|
|
3
|
-
import type { AttributesToken, ExtToken } from '../../internal';
|
|
4
|
-
/** 扩展标签内的纯文字Token */
|
|
5
|
-
export declare class NowikiToken extends NowikiBaseToken {
|
|
6
|
-
readonly type = "ext-inner";
|
|
7
|
-
name: string;
|
|
8
|
-
abstract get nextSibling(): undefined;
|
|
9
|
-
abstract get nextElementSibling(): undefined;
|
|
10
|
-
abstract get previousSibling(): AttributesToken;
|
|
11
|
-
abstract get previousElementSibling(): AttributesToken;
|
|
12
|
-
abstract get parentNode(): ExtToken | undefined;
|
|
13
|
-
abstract get parentElement(): ExtToken | undefined;
|
|
14
|
-
/** @override */
|
|
15
|
-
lint(start?: number): LintError[];
|
|
16
|
-
}
|
package/dist/src/nowiki/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NowikiToken = void 0;
|
|
4
|
-
const lint_1 = require("../../util/lint");
|
|
5
|
-
const Parser = require("../../index");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
/** 扩展标签内的纯文字Token */
|
|
8
|
-
// @ts-expect-error not implementing all abstract methods
|
|
9
|
-
class NowikiToken extends base_1.NowikiBaseToken {
|
|
10
|
-
type = 'ext-inner';
|
|
11
|
-
/** @override */
|
|
12
|
-
lint(start = this.getAbsoluteIndex()) {
|
|
13
|
-
const { name, firstChild } = this;
|
|
14
|
-
return (name === 'templatestyles' || name === 'section') && firstChild.data
|
|
15
|
-
? [(0, lint_1.generateForSelf)(this, { start }, Parser.msg('nothing should be in <$1>', name))]
|
|
16
|
-
: super.lint(start);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.NowikiToken = NowikiToken;
|
|
20
|
-
Parser.classes['NowikiToken'] = __filename;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { ListBaseToken } from './listBase';
|
|
3
|
-
import type { AstRange } from '../../lib/range';
|
|
4
|
-
declare const ListToken_base: (abstract new (...args: any[]) => {
|
|
5
|
-
"__#7@#isRoot"(): boolean;
|
|
6
|
-
prependNewLine(): string;
|
|
7
|
-
toString(omit?: Set<string> | undefined): string;
|
|
8
|
-
getPadding(): number;
|
|
9
|
-
text(): string;
|
|
10
|
-
length: number;
|
|
11
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
12
|
-
afterBuild(): void;
|
|
13
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
14
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
15
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
16
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
17
|
-
}) & typeof ListBaseToken;
|
|
18
|
-
/** 位于行首的`;:*#` */
|
|
19
|
-
export declare class ListToken extends ListToken_base {
|
|
20
|
-
readonly type = "list";
|
|
21
|
-
/** 获取列表行的范围 */
|
|
22
|
-
getRange(): AstRange;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
package/dist/src/nowiki/list.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListToken = void 0;
|
|
4
|
-
const sol_1 = require("../../mixin/sol");
|
|
5
|
-
const Parser = require("../../index");
|
|
6
|
-
const listBase_1 = require("./listBase");
|
|
7
|
-
/** 位于行首的`;:*#` */
|
|
8
|
-
// @ts-expect-error not implementing all abstract methods
|
|
9
|
-
class ListToken extends (0, sol_1.sol)(listBase_1.ListBaseToken) {
|
|
10
|
-
type = 'list';
|
|
11
|
-
/* NOT FOR BROWSER */
|
|
12
|
-
/** 获取列表行的范围 */
|
|
13
|
-
getRange() {
|
|
14
|
-
const range = this.createRange();
|
|
15
|
-
range.setStartBefore(this);
|
|
16
|
-
let { nextSibling } = this;
|
|
17
|
-
while (nextSibling && (nextSibling.type !== 'text' || !nextSibling.data.includes('\n'))) {
|
|
18
|
-
({ nextSibling } = nextSibling);
|
|
19
|
-
}
|
|
20
|
-
if (nextSibling) {
|
|
21
|
-
const i = nextSibling.data.indexOf('\n');
|
|
22
|
-
range.setEnd(nextSibling, i);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
range.setEndAfter(this.parentNode);
|
|
26
|
-
}
|
|
27
|
-
return range;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.ListToken = ListToken;
|
|
31
|
-
Parser.classes['ListToken'] = __filename;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
declare const ListBaseToken_base: (abstract new (...args: any[]) => {
|
|
4
|
-
"__#8@#pattern": RegExp;
|
|
5
|
-
/** 是否包含`*` */
|
|
6
|
-
afterBuild(): void;
|
|
7
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
8
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
9
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
10
|
-
length: number;
|
|
11
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
12
|
-
text(separator?: string | undefined): string;
|
|
13
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
14
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
15
|
-
}) & typeof NowikiBaseToken;
|
|
16
|
-
/** `;:*#` */
|
|
17
|
-
export declare class ListBaseToken extends ListBaseToken_base {
|
|
18
|
-
type: 'dd' | 'list';
|
|
19
|
-
/** 是否包含`;` */
|
|
20
|
-
get dt(): boolean;
|
|
21
|
-
/** 是否包含`*` */
|
|
22
|
-
get ul(): boolean;
|
|
23
|
-
/** 是否包含`#` */
|
|
24
|
-
get ol(): boolean;
|
|
25
|
-
/** 缩进数 */
|
|
26
|
-
get indent(): number;
|
|
27
|
-
set indent(indent: number);
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListBaseToken = void 0;
|
|
4
|
-
const syntax_1 = require("../../mixin/syntax");
|
|
5
|
-
const Parser = require("../../index");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
/** `;:*#` */
|
|
8
|
-
// @ts-expect-error not implementing all abstract methods
|
|
9
|
-
class ListBaseToken extends (0, syntax_1.syntax)(base_1.NowikiBaseToken, /^[;:*#]+$/u) {
|
|
10
|
-
/* NOT FOR BROWSER */
|
|
11
|
-
/** 是否包含`;` */
|
|
12
|
-
get dt() {
|
|
13
|
-
return this.firstChild.data.includes(';');
|
|
14
|
-
}
|
|
15
|
-
/** 是否包含`*` */
|
|
16
|
-
get ul() {
|
|
17
|
-
return this.firstChild.data.includes('*');
|
|
18
|
-
}
|
|
19
|
-
/** 是否包含`#` */
|
|
20
|
-
get ol() {
|
|
21
|
-
return this.firstChild.data.includes('#');
|
|
22
|
-
}
|
|
23
|
-
/** 缩进数 */
|
|
24
|
-
get indent() {
|
|
25
|
-
return this.firstChild.data.split(':').length - 1;
|
|
26
|
-
}
|
|
27
|
-
set indent(indent) {
|
|
28
|
-
if (this.type === 'dd') {
|
|
29
|
-
this.setText(':'.repeat(indent));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.ListBaseToken = ListBaseToken;
|
|
34
|
-
Parser.classes['ListBase'] = __filename;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
declare const NoincludeToken_base: ((abstract new (...args: any[]) => {
|
|
4
|
-
text(): string;
|
|
5
|
-
length: number;
|
|
6
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
7
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
8
|
-
afterBuild(): void;
|
|
9
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
10
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
11
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
12
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
13
|
-
}) & {
|
|
14
|
-
readonly hidden: true;
|
|
15
|
-
}) & typeof NowikiBaseToken;
|
|
16
|
-
/** `<noinclude>`和`</noinclude>`,不可进行任何更改 */
|
|
17
|
-
export declare class NoincludeToken extends NoincludeToken_base {
|
|
18
|
-
readonly type = "noinclude";
|
|
19
|
-
/**
|
|
20
|
-
* @override
|
|
21
|
-
* @param str 新文本
|
|
22
|
-
* @throws `Error` 不可更改
|
|
23
|
-
*/
|
|
24
|
-
setText(str: string): string;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoincludeToken = void 0;
|
|
4
|
-
const hidden_1 = require("../../mixin/hidden");
|
|
5
|
-
const Parser = require("../../index");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
/** `<noinclude>`和`</noinclude>`,不可进行任何更改 */
|
|
8
|
-
// @ts-expect-error not implementing all abstract methods
|
|
9
|
-
class NoincludeToken extends (0, hidden_1.hidden)(base_1.NowikiBaseToken) {
|
|
10
|
-
type = 'noinclude';
|
|
11
|
-
/* NOT FOR BROWSER */
|
|
12
|
-
/**
|
|
13
|
-
* @override
|
|
14
|
-
* @param str 新文本
|
|
15
|
-
* @throws `Error` 不可更改
|
|
16
|
-
*/
|
|
17
|
-
setText(str) {
|
|
18
|
-
if (/^<\/?(?:(?:no|only)include|includeonly)(?:\s.*)?\/?>$/isu.test(this.firstChild.data)) {
|
|
19
|
-
throw new Error(`${this.constructor.name} 不可更改文字内容!`);
|
|
20
|
-
}
|
|
21
|
-
return super.setText(str);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.NoincludeToken = NoincludeToken;
|
|
25
|
-
Parser.classes['NoincludeToken'] = __filename;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Parser from '../../index';
|
|
2
|
-
import { NowikiBaseToken } from './base';
|
|
3
|
-
import type { LintError } from '../../index';
|
|
4
|
-
declare const QuoteToken_base: (abstract new (...args: any[]) => {
|
|
5
|
-
"__#8@#pattern": RegExp;
|
|
6
|
-
afterBuild(): void;
|
|
7
|
-
getAttribute<T extends string>(key: T): TokenAttributeGetter<T>;
|
|
8
|
-
setAttribute<T_1 extends string>(key: T_1, value: TokenAttributeSetter<T_1>): void;
|
|
9
|
-
replaceChildren(...elements: (string | Parser.AstNodes)[]): void;
|
|
10
|
-
length: number;
|
|
11
|
-
toString(omit?: Set<string> | undefined, separator?: string | undefined): string;
|
|
12
|
-
text(separator?: string | undefined): string;
|
|
13
|
-
insertAt(token: unknown, i?: number | undefined): unknown;
|
|
14
|
-
addEventListener(events: string | string[], listener: AstListener): void;
|
|
15
|
-
}) & typeof NowikiBaseToken;
|
|
16
|
-
/** `''`和`'''` */
|
|
17
|
-
export declare class QuoteToken extends QuoteToken_base {
|
|
18
|
-
readonly type = "quote";
|
|
19
|
-
/** @override */
|
|
20
|
-
lint(start?: number): LintError[];
|
|
21
|
-
}
|
|
22
|
-
export {};
|
package/dist/src/nowiki/quote.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuoteToken = void 0;
|
|
4
|
-
const lint_1 = require("../../util/lint");
|
|
5
|
-
const syntax_1 = require("../../mixin/syntax");
|
|
6
|
-
const Parser = require("../../index");
|
|
7
|
-
const base_1 = require("./base");
|
|
8
|
-
/** `''`和`'''` */
|
|
9
|
-
// @ts-expect-error not implementing all abstract methods
|
|
10
|
-
class QuoteToken extends (0, syntax_1.syntax)(base_1.NowikiBaseToken, /^(?:'{5}|'''?)$/u) {
|
|
11
|
-
type = 'quote';
|
|
12
|
-
/** @override */
|
|
13
|
-
lint(start = this.getAbsoluteIndex()) {
|
|
14
|
-
const { previousSibling, nextSibling } = this, message = Parser.msg('lonely "$1"', `'`), errors = [];
|
|
15
|
-
let refError, wikitext;
|
|
16
|
-
if (previousSibling?.type === 'text' && previousSibling.data.endsWith(`'`)) {
|
|
17
|
-
refError = (0, lint_1.generateForSelf)(this, { start }, message);
|
|
18
|
-
wikitext = String(this.getRootNode());
|
|
19
|
-
const { startIndex: endIndex, startLine: endLine, startCol: endCol } = refError, [{ length }] = previousSibling.data.match(/(?<!')'+$/u), startIndex = start - length;
|
|
20
|
-
errors.push({
|
|
21
|
-
...refError,
|
|
22
|
-
startIndex,
|
|
23
|
-
endIndex,
|
|
24
|
-
startCol: endCol - length,
|
|
25
|
-
endLine,
|
|
26
|
-
endCol,
|
|
27
|
-
excerpt: wikitext.slice(startIndex, startIndex + 50),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (nextSibling?.type === 'text' && nextSibling.data.startsWith(`'`)) {
|
|
31
|
-
refError ??= (0, lint_1.generateForSelf)(this, { start }, message);
|
|
32
|
-
wikitext ??= String(this.getRootNode());
|
|
33
|
-
const { endIndex: startIndex, endLine: startLine, endCol: startCol } = refError, [{ length }] = nextSibling.data.match(/^'+/u), endIndex = startIndex + length;
|
|
34
|
-
errors.push({
|
|
35
|
-
...refError,
|
|
36
|
-
startIndex,
|
|
37
|
-
endIndex,
|
|
38
|
-
startLine,
|
|
39
|
-
startCol,
|
|
40
|
-
endCol: startCol + length,
|
|
41
|
-
excerpt: wikitext.slice(Math.max(0, endIndex - 50), endIndex),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return errors;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.QuoteToken = QuoteToken;
|
|
48
|
-
Parser.classes['QuoteToken'] = __filename;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Token } from './index';
|
|
2
|
-
/**
|
|
3
|
-
* 嵌入时的`<onlyinclude>`
|
|
4
|
-
* @classdesc `{childNodes: ...AstText|Token}`
|
|
5
|
-
*/
|
|
6
|
-
export declare class OnlyincludeToken extends Token {
|
|
7
|
-
readonly type = "onlyinclude";
|
|
8
|
-
/** 内部wikitext */
|
|
9
|
-
get innerText(): string;
|
|
10
|
-
/** @override */
|
|
11
|
-
print(): string;
|
|
12
|
-
/** @override */
|
|
13
|
-
cloneNode(): this;
|
|
14
|
-
}
|