wikiparser-node 1.4.2 → 1.4.3
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/dist/addon/table.js +5 -1
- package/dist/base.d.ts +6 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +3 -3
- package/dist/lib/element.d.ts +3 -2
- package/dist/lib/element.js +20 -13
- package/dist/lib/node.js +13 -10
- package/dist/lib/text.js +3 -3
- package/dist/lib/title.js +4 -12
- package/dist/mixin/attributesParent.d.ts +32 -2
- package/dist/mixin/attributesParent.js +14 -25
- package/dist/mixin/fixed.d.ts +2 -1
- package/dist/mixin/fixed.js +3 -1
- package/dist/mixin/flagsParent.d.ts +28 -17
- package/dist/mixin/flagsParent.js +12 -25
- package/dist/mixin/magicLinkParent.d.ts +14 -8
- package/dist/mixin/magicLinkParent.js +7 -8
- package/dist/mixin/singleLine.d.ts +2 -1
- package/dist/mixin/singleLine.js +3 -2
- package/dist/mixin/sol.d.ts +2 -4
- package/dist/mixin/sol.js +8 -6
- package/dist/mixin/syntax.d.ts +5 -2
- package/dist/mixin/syntax.js +14 -18
- package/dist/parser/links.js +1 -3
- package/dist/src/arg.d.ts +4 -4
- package/dist/src/arg.js +4 -4
- package/dist/src/attribute.d.ts +9 -7
- package/dist/src/attribute.js +271 -218
- package/dist/src/attributes.d.ts +3 -3
- package/dist/src/attributes.js +0 -1
- package/dist/src/converter.d.ts +7 -2
- package/dist/src/converter.js +113 -64
- package/dist/src/converterFlags.d.ts +5 -5
- package/dist/src/converterFlags.js +0 -1
- package/dist/src/converterRule.d.ts +5 -5
- package/dist/src/converterRule.js +0 -1
- package/dist/src/extLink.d.ts +7 -2
- package/dist/src/extLink.js +159 -110
- package/dist/src/gallery.d.ts +5 -5
- package/dist/src/gallery.js +0 -1
- package/dist/src/heading.d.ts +8 -8
- package/dist/src/heading.js +172 -125
- package/dist/src/html.d.ts +8 -5
- package/dist/src/html.js +263 -214
- package/dist/src/imageParameter.d.ts +2 -2
- package/dist/src/imageParameter.js +1 -0
- package/dist/src/imagemap.d.ts +5 -5
- package/dist/src/imagemap.js +4 -10
- package/dist/src/imagemapLink.d.ts +7 -4
- package/dist/src/imagemapLink.js +75 -26
- package/dist/src/index.js +3 -4
- package/dist/src/link/base.d.ts +2 -2
- package/dist/src/link/base.js +1 -4
- package/dist/src/link/file.d.ts +1 -1
- package/dist/src/link/file.js +0 -1
- package/dist/src/link/galleryImage.d.ts +2 -1
- package/dist/src/link/galleryImage.js +136 -88
- package/dist/src/link/index.js +0 -1
- package/dist/src/magicLink.d.ts +11 -3
- package/dist/src/magicLink.js +170 -120
- package/dist/src/nested.d.ts +5 -5
- package/dist/src/nested.js +1 -0
- package/dist/src/nowiki/base.d.ts +6 -2
- package/dist/src/nowiki/base.js +79 -28
- package/dist/src/nowiki/comment.d.ts +0 -2
- package/dist/src/nowiki/comment.js +0 -9
- package/dist/src/nowiki/doubleUnderscore.js +88 -38
- package/dist/src/nowiki/hr.d.ts +1 -4
- package/dist/src/nowiki/hr.js +53 -4
- package/dist/src/nowiki/index.d.ts +2 -2
- package/dist/src/nowiki/index.js +1 -0
- package/dist/src/nowiki/list.d.ts +1 -4
- package/dist/src/nowiki/list.js +88 -39
- package/dist/src/nowiki/listBase.d.ts +1 -1
- package/dist/src/nowiki/listBase.js +52 -2
- package/dist/src/nowiki/quote.d.ts +3 -3
- package/dist/src/nowiki/quote.js +102 -54
- package/dist/src/paramTag/index.d.ts +5 -5
- package/dist/src/paramTag/index.js +2 -1
- package/dist/src/parameter.d.ts +11 -8
- package/dist/src/parameter.js +225 -176
- package/dist/src/pre.d.ts +5 -5
- package/dist/src/pre.js +1 -0
- package/dist/src/syntax.d.ts +6 -0
- package/dist/src/syntax.js +74 -23
- package/dist/src/table/base.d.ts +6 -3
- package/dist/src/table/base.js +100 -49
- package/dist/src/table/index.d.ts +6 -3
- package/dist/src/table/index.js +5 -9
- package/dist/src/table/td.d.ts +9 -5
- package/dist/src/table/td.js +270 -217
- package/dist/src/table/tr.d.ts +4 -4
- package/dist/src/table/tr.js +1 -0
- package/dist/src/tagPair/ext.d.ts +6 -3
- package/dist/src/tagPair/ext.js +168 -118
- package/dist/src/tagPair/include.d.ts +2 -4
- package/dist/src/tagPair/include.js +0 -8
- package/dist/src/tagPair/index.d.ts +1 -1
- package/dist/src/tagPair/index.js +115 -66
- package/dist/src/transclude.d.ts +3 -3
- package/dist/src/transclude.js +4 -9
- package/dist/util/debug.js +0 -2
- package/package.json +3 -3
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
2
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
37
|
exports.DoubleUnderscoreToken = void 0;
|
|
4
38
|
const debug_1 = require("../../util/debug");
|
|
@@ -8,44 +42,60 @@ const syntax_1 = require("../../mixin/syntax");
|
|
|
8
42
|
const index_1 = require("../../index");
|
|
9
43
|
const base_1 = require("./base");
|
|
10
44
|
/** 状态开关 */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
45
|
+
let DoubleUnderscoreToken = (() => {
|
|
46
|
+
let _classDecorators = [(0, syntax_1.syntax)()];
|
|
47
|
+
let _classDescriptor;
|
|
48
|
+
let _classExtraInitializers = [];
|
|
49
|
+
let _classThis;
|
|
50
|
+
let _classSuper = (0, hidden_1.hiddenToken)(base_1.NowikiBaseToken);
|
|
51
|
+
var DoubleUnderscoreToken = class extends _classSuper {
|
|
52
|
+
static { _classThis = this; }
|
|
53
|
+
static {
|
|
54
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
55
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
56
|
+
DoubleUnderscoreToken = _classThis = _classDescriptor.value;
|
|
57
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
58
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
59
|
+
}
|
|
60
|
+
type = 'double-underscore';
|
|
61
|
+
#sensitive;
|
|
62
|
+
/* NOT FOR BROWSER END */
|
|
63
|
+
/**
|
|
64
|
+
* @param word 状态开关名
|
|
65
|
+
* @param sensitive 是否固定大小写
|
|
66
|
+
*/
|
|
67
|
+
constructor(word, sensitive, config = index_1.default.getConfig(), accum = []) {
|
|
68
|
+
super(word, config, accum);
|
|
69
|
+
/* NOT FOR BROWSER */
|
|
70
|
+
this.#sensitive = sensitive;
|
|
71
|
+
this.setAttribute('name', word.toLowerCase());
|
|
72
|
+
this.setAttribute('pattern', new RegExp(`^${word}$`, sensitive ? 'u' : 'iu'));
|
|
73
|
+
}
|
|
74
|
+
/** @private */
|
|
75
|
+
getAttribute(key) {
|
|
76
|
+
return key === 'padding' ? 2 : super.getAttribute(key);
|
|
77
|
+
}
|
|
78
|
+
/** @private */
|
|
79
|
+
toString() {
|
|
80
|
+
return `__${this.innerText}__`;
|
|
81
|
+
}
|
|
82
|
+
/** @override */
|
|
83
|
+
print() {
|
|
84
|
+
return super.print({ pre: '__', post: '__' });
|
|
85
|
+
}
|
|
21
86
|
/* NOT FOR BROWSER */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
print() {
|
|
36
|
-
return super.print({ pre: '__', post: '__' });
|
|
37
|
-
}
|
|
38
|
-
/* NOT FOR BROWSER */
|
|
39
|
-
/** @override */
|
|
40
|
-
cloneNode() {
|
|
41
|
-
const config = this.getAttribute('config');
|
|
42
|
-
return debug_1.Shadow.run(() => {
|
|
43
|
-
// @ts-expect-error abstract class
|
|
44
|
-
const token = new DoubleUnderscoreToken(this.innerText, this.#sensitive, config);
|
|
45
|
-
token.afterBuild();
|
|
46
|
-
return token;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
87
|
+
/** @override */
|
|
88
|
+
cloneNode() {
|
|
89
|
+
const config = this.getAttribute('config');
|
|
90
|
+
return debug_1.Shadow.run(() => {
|
|
91
|
+
// @ts-expect-error abstract class
|
|
92
|
+
const token = new DoubleUnderscoreToken(this.innerText, this.#sensitive, config);
|
|
93
|
+
token.afterBuild();
|
|
94
|
+
return token;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return DoubleUnderscoreToken = _classThis;
|
|
99
|
+
})();
|
|
50
100
|
exports.DoubleUnderscoreToken = DoubleUnderscoreToken;
|
|
51
101
|
constants_1.classes['DoubleUnderscoreToken'] = __filename;
|
package/dist/src/nowiki/hr.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { NowikiBaseToken } from './base';
|
|
2
|
-
|
|
3
|
-
export interface HrToken extends SolTokenBase {
|
|
4
|
-
}
|
|
2
|
+
/** `<hr>` */
|
|
5
3
|
export declare abstract class HrToken extends NowikiBaseToken {
|
|
6
4
|
readonly type = "hr";
|
|
7
5
|
}
|
|
8
|
-
export {};
|
package/dist/src/nowiki/hr.js
CHANGED
|
@@ -1,14 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
2
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
37
|
exports.HrToken = void 0;
|
|
4
38
|
const constants_1 = require("../../util/constants");
|
|
5
39
|
const sol_1 = require("../../mixin/sol");
|
|
6
40
|
const syntax_1 = require("../../mixin/syntax");
|
|
7
41
|
const base_1 = require("./base");
|
|
8
|
-
/* NOT FOR BROWSER END */
|
|
9
42
|
/** `<hr>` */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
43
|
+
let HrToken = (() => {
|
|
44
|
+
let _classDecorators = [sol_1.sol, (0, syntax_1.syntax)(/^-{4,}$/u)];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
let _classSuper = base_1.NowikiBaseToken;
|
|
49
|
+
var HrToken = class extends _classSuper {
|
|
50
|
+
static { _classThis = this; }
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
54
|
+
HrToken = _classThis = _classDescriptor.value;
|
|
55
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
56
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
57
|
+
}
|
|
58
|
+
type = 'hr';
|
|
59
|
+
};
|
|
60
|
+
return HrToken = _classThis;
|
|
61
|
+
})();
|
|
13
62
|
exports.HrToken = HrToken;
|
|
14
63
|
constants_1.classes['HrToken'] = __filename;
|
|
@@ -6,10 +6,10 @@ export declare abstract class NowikiToken extends NowikiBaseToken {
|
|
|
6
6
|
readonly type = "ext-inner";
|
|
7
7
|
readonly name: string;
|
|
8
8
|
abstract get nextSibling(): undefined;
|
|
9
|
-
abstract get nextElementSibling(): undefined;
|
|
10
9
|
abstract get previousSibling(): AttributesToken;
|
|
11
|
-
abstract get previousElementSibling(): AttributesToken;
|
|
12
10
|
abstract get parentNode(): ExtToken | undefined;
|
|
11
|
+
abstract get nextElementSibling(): undefined;
|
|
12
|
+
abstract get previousElementSibling(): AttributesToken;
|
|
13
13
|
abstract get parentElement(): ExtToken | undefined;
|
|
14
14
|
/** @override */
|
|
15
15
|
lint(start?: number): LintError[];
|
package/dist/src/nowiki/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const base_1 = require("./base");
|
|
|
8
8
|
/** 扩展标签内的纯文字Token */
|
|
9
9
|
class NowikiToken extends base_1.NowikiBaseToken {
|
|
10
10
|
type = 'ext-inner';
|
|
11
|
+
/* NOT FOR BROWSER END */
|
|
11
12
|
/** @override */
|
|
12
13
|
lint(start = this.getAbsoluteIndex()) {
|
|
13
14
|
const { name, firstChild: { data } } = this;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ListBaseToken } from './listBase';
|
|
2
2
|
import type { AstRange } from '../../lib/range';
|
|
3
|
-
|
|
4
|
-
export interface ListToken extends SolTokenBase {
|
|
5
|
-
}
|
|
3
|
+
/** 位于行首的`;:*#` */
|
|
6
4
|
export declare abstract class ListToken extends ListBaseToken {
|
|
7
5
|
readonly type = "list";
|
|
8
6
|
/** 是否包含`:` */
|
|
@@ -16,4 +14,3 @@ export declare abstract class ListToken extends ListBaseToken {
|
|
|
16
14
|
/** 获取列表行的范围 */
|
|
17
15
|
getRange(): AstRange;
|
|
18
16
|
}
|
|
19
|
-
export {};
|
package/dist/src/nowiki/list.js
CHANGED
|
@@ -1,48 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
2
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
37
|
exports.ListToken = void 0;
|
|
4
38
|
const constants_1 = require("../../util/constants");
|
|
5
39
|
const sol_1 = require("../../mixin/sol");
|
|
6
40
|
const listBase_1 = require("./listBase");
|
|
7
|
-
/* NOT FOR BROWSER END */
|
|
8
41
|
/** 位于行首的`;:*#` */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
42
|
+
let ListToken = (() => {
|
|
43
|
+
let _classDecorators = [sol_1.sol];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = listBase_1.ListBaseToken;
|
|
48
|
+
var ListToken = class extends _classSuper {
|
|
49
|
+
static { _classThis = this; }
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
52
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
53
|
+
ListToken = _classThis = _classDescriptor.value;
|
|
54
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
55
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
56
|
+
}
|
|
57
|
+
type = 'list';
|
|
58
|
+
/* NOT FOR BROWSER */
|
|
59
|
+
/** 是否包含`:` */
|
|
60
|
+
get dd() {
|
|
61
|
+
return this.innerText.includes(':');
|
|
62
|
+
}
|
|
63
|
+
/** 是否包含`;` */
|
|
64
|
+
get dt() {
|
|
65
|
+
return this.innerText.includes(';');
|
|
66
|
+
}
|
|
67
|
+
/** 是否包含`*` */
|
|
68
|
+
get ul() {
|
|
69
|
+
return this.innerText.includes('*');
|
|
70
|
+
}
|
|
71
|
+
/** 是否包含`#` */
|
|
72
|
+
get ol() {
|
|
73
|
+
return this.innerText.includes('#');
|
|
74
|
+
}
|
|
75
|
+
/** 获取列表行的范围 */
|
|
76
|
+
getRange() {
|
|
77
|
+
const range = this.createRange();
|
|
78
|
+
range.setStartBefore(this);
|
|
79
|
+
let { nextSibling } = this;
|
|
80
|
+
while (nextSibling && (nextSibling.type !== 'text' || !nextSibling.data.includes('\n'))) {
|
|
81
|
+
({ nextSibling } = nextSibling);
|
|
82
|
+
}
|
|
83
|
+
if (nextSibling) {
|
|
84
|
+
const i = nextSibling.data.indexOf('\n');
|
|
85
|
+
range.setEnd(nextSibling, i);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const { parentNode } = this;
|
|
89
|
+
range.setEnd(parentNode, parentNode.length);
|
|
90
|
+
}
|
|
91
|
+
return range;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return ListToken = _classThis;
|
|
95
|
+
})();
|
|
47
96
|
exports.ListToken = ListToken;
|
|
48
97
|
constants_1.classes['ListToken'] = __filename;
|
|
@@ -1,11 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
2
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
37
|
exports.ListBaseToken = void 0;
|
|
4
38
|
const constants_1 = require("../../util/constants");
|
|
5
39
|
const syntax_1 = require("../../mixin/syntax");
|
|
6
40
|
const base_1 = require("./base");
|
|
7
41
|
/** `;:*#` */
|
|
8
|
-
|
|
9
|
-
|
|
42
|
+
let ListBaseToken = (() => {
|
|
43
|
+
let _classDecorators = [(0, syntax_1.syntax)(/^[;:*#]+$/u)];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = base_1.NowikiBaseToken;
|
|
48
|
+
var ListBaseToken = class extends _classSuper {
|
|
49
|
+
static { _classThis = this; }
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
52
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
53
|
+
ListBaseToken = _classThis = _classDescriptor.value;
|
|
54
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
55
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return ListBaseToken = _classThis;
|
|
59
|
+
})();
|
|
10
60
|
exports.ListBaseToken = ListBaseToken;
|
|
11
61
|
constants_1.classes['ListBase'] = __filename;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NowikiBaseToken } from './base';
|
|
2
|
-
import type { LintError } from '../../base';
|
|
2
|
+
import type { LintError, AST } from '../../base';
|
|
3
|
+
/** `''`和`'''` */
|
|
3
4
|
export declare abstract class QuoteToken extends NowikiBaseToken {
|
|
4
5
|
readonly type = "quote";
|
|
5
6
|
/** 是否粗体 */
|
|
@@ -9,6 +10,5 @@ export declare abstract class QuoteToken extends NowikiBaseToken {
|
|
|
9
10
|
/** @override */
|
|
10
11
|
lint(start?: number): LintError[];
|
|
11
12
|
/** @override */
|
|
12
|
-
json():
|
|
13
|
+
json(): AST;
|
|
13
14
|
}
|
|
14
|
-
export {};
|