wikiparser-node 1.17.0 → 1.18.0
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 +20 -0
- package/bin/config.js +3 -0
- package/bundle/{bundle.es7.js → bundle-es7.min.js} +19 -19
- package/bundle/bundle-lsp.min.js +38 -0
- package/bundle/bundle.min.js +19 -19
- package/config/.schema.json +7 -3
- package/config/default.json +86 -23
- package/config/enwiki.json +20 -13
- package/config/llwiki.json +99 -7
- package/config/minimum.json +6 -3
- package/config/moegirl.json +12 -12
- package/config/zhwiki.json +52 -21
- package/data/.schema.json +7 -0
- package/data/ext/mapframe.json +4 -0
- package/data/ext/maplink.json +4 -0
- package/data/ext/score.json +1033 -0
- package/data/ext/templatedata.json +184 -0
- package/dist/addon/table.js +16 -10
- package/dist/addon/token.js +13 -9
- package/dist/addon/transclude.js +6 -3
- package/dist/base.d.mts +4 -2
- package/dist/base.d.ts +4 -2
- package/dist/base.js +2 -0
- package/dist/base.mjs +3 -1
- package/dist/bin/config.js +112 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -21
- package/dist/lib/document.d.ts +54 -0
- package/dist/lib/document.js +126 -0
- package/dist/lib/element.js +6 -3
- package/dist/lib/lsp.d.ts +7 -7
- package/dist/lib/lsp.js +314 -47
- package/dist/lib/node.js +19 -9
- package/dist/lib/text.js +4 -1
- package/dist/lib/title.js +9 -6
- package/dist/mixin/attributesParent.d.ts +8 -0
- package/dist/mixin/attributesParent.js +4 -0
- package/dist/parser/links.js +4 -1
- package/dist/parser/redirect.js +4 -1
- package/dist/src/arg.js +10 -3
- package/dist/src/attribute.d.ts +12 -1
- package/dist/src/attribute.js +69 -1
- package/dist/src/attributes.d.ts +8 -0
- package/dist/src/attributes.js +14 -1
- package/dist/src/converter.d.ts +62 -3
- package/dist/src/converter.js +162 -129
- package/dist/src/converterFlags.js +2 -2
- package/dist/src/converterRule.js +4 -1
- package/dist/src/extLink.d.ts +19 -3
- package/dist/src/extLink.js +177 -194
- package/dist/src/gallery.js +7 -3
- package/dist/src/heading.js +9 -4
- package/dist/src/html.js +4 -1
- package/dist/src/imageParameter.js +9 -3
- package/dist/src/imagemap.js +4 -1
- package/dist/src/index.js +34 -4
- package/dist/src/link/base.js +8 -2
- package/dist/src/link/file.js +11 -2
- package/dist/src/link/galleryImage.d.ts +1 -0
- package/dist/src/link/galleryImage.js +15 -1
- package/dist/src/magicLink.js +4 -1
- package/dist/src/nested.js +4 -1
- package/dist/src/nowiki/comment.js +4 -1
- package/dist/src/nowiki/index.js +4 -1
- package/dist/src/nowiki/quote.js +4 -1
- package/dist/src/onlyinclude.js +4 -1
- package/dist/src/paramTag/index.js +5 -1
- package/dist/src/paramTag/inputbox.js +4 -1
- package/dist/src/parameter.js +4 -1
- package/dist/src/pre.js +4 -1
- package/dist/src/redirect.js +3 -1
- package/dist/src/table/base.js +4 -1
- package/dist/src/table/index.js +10 -3
- package/dist/src/table/td.js +4 -1
- package/dist/src/tagPair/ext.js +17 -5
- package/dist/src/tagPair/include.js +4 -1
- package/dist/src/tagPair/index.js +4 -1
- package/dist/src/transclude.js +16 -7
- package/dist/util/debug.js +1 -13
- package/dist/util/diff.js +20 -6
- package/dist/util/lint.js +4 -1
- package/dist/util/string.js +5 -2
- package/extensions/dist/base.js +30 -18
- package/extensions/dist/lsp.js +30 -22
- package/extensions/es7/base.js +30 -18
- package/extensions/typings.d.ts +6 -2
- package/package.json +27 -16
- package/bundle/bundle.lsp.js +0 -38
- package/dist/mixin/flagsParent.d.ts +0 -69
- package/dist/mixin/flagsParent.js +0 -64
- package/dist/mixin/magicLinkParent.d.ts +0 -25
- package/dist/mixin/magicLinkParent.js +0 -43
- package/dist/util/sharable.d.ts +0 -1
package/dist/src/link/file.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.FileToken = void 0;
|
|
4
7
|
const string_1 = require("../../util/string");
|
|
5
8
|
const lint_1 = require("../../util/lint");
|
|
6
9
|
const rect_1 = require("../../lib/rect");
|
|
7
|
-
const index_1 = require("../../index");
|
|
10
|
+
const index_1 = __importDefault(require("../../index"));
|
|
8
11
|
const base_1 = require("./base");
|
|
9
12
|
const imageParameter_1 = require("../imageParameter");
|
|
10
13
|
/* NOT FOR BROWSER */
|
|
@@ -380,7 +383,13 @@ class FileToken extends base_1.LinkBaseToken {
|
|
|
380
383
|
toHtmlInternal(opt) {
|
|
381
384
|
/** @ignore */
|
|
382
385
|
const isInteger = (n) => Boolean(n && !/\D/u.test(n));
|
|
383
|
-
const { link, width, height, type } = this, file = this.getAttribute('title'), fr = this.getFrame(), manual = fr instanceof title_1.Title, visibleCaption = manual || fr === 'thumbnail' || fr === 'framed' || type === 'gallery-image', caption = this.getArg('caption')?.toHtmlInternal({
|
|
386
|
+
const { link, width, height, type } = this, file = this.getAttribute('title'), fr = this.getFrame(), manual = fr instanceof title_1.Title, visibleCaption = manual || fr === 'thumbnail' || fr === 'framed' || type === 'gallery-image', caption = this.getArg('caption')?.toHtmlInternal({
|
|
387
|
+
...opt,
|
|
388
|
+
nowrap: true,
|
|
389
|
+
}) ?? '', titleFromCaption = visibleCaption && type !== 'gallery-image' ? '' : (0, string_1.sanitizeAlt)(caption), hasLink = manual || link !== file, title = titleFromCaption || (hasLink && typeof link !== 'string' ? link.getTitleAttr() : ''), titleAttr = title && ` title="${title}"`, alt = (0, string_1.sanitizeAlt)(this.getArg('alt')?.toHtmlInternal({
|
|
390
|
+
...opt,
|
|
391
|
+
nowrap: true,
|
|
392
|
+
})) ?? titleFromCaption, horiz = this.getHorizAlign() ?? '', vert = this.getVertAlign() ?? '', className = `${horiz ? `mw-halign-${horiz}` : vert && `mw-valign-${vert}`}${this.getValue('border') ? ' mw-image-border' : ''} ${(0, string_1.sanitizeAlt)(this.getValue('class')) ?? ''}`.trim(), classAttr = className && ` class="${className}"`, img = `<img${alt && ` alt="${alt}"`} src="${(manual ? fr : file).getUrl()}" class="mw-file-element"${isInteger(width) ? ` width="${width}"` : ''}${isInteger(height) ? ` height="${height}"` : ''}>`;
|
|
384
393
|
let href = '';
|
|
385
394
|
if (link) {
|
|
386
395
|
try {
|
|
@@ -33,14 +33,18 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.GalleryImageToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const constants_1 = require("../../util/constants");
|
|
40
|
-
const index_1 = require("../../index");
|
|
43
|
+
const index_1 = __importDefault(require("../../index"));
|
|
41
44
|
const index_2 = require("../index");
|
|
42
45
|
const file_1 = require("./file");
|
|
43
46
|
/* NOT FOR BROWSER */
|
|
47
|
+
const debug_1 = require("../../util/debug");
|
|
44
48
|
const singleLine_1 = require("../../mixin/singleLine");
|
|
45
49
|
const imageParameter_1 = require("../imageParameter");
|
|
46
50
|
/**
|
|
@@ -135,6 +139,16 @@ let GalleryImageToken = (() => {
|
|
|
135
139
|
}
|
|
136
140
|
return super.insertAt(child, i);
|
|
137
141
|
}
|
|
142
|
+
cloneNode() {
|
|
143
|
+
const [link, ...linkText] = this.cloneChildNodes();
|
|
144
|
+
return debug_1.Shadow.run(() => {
|
|
145
|
+
// @ts-expect-error abstract class
|
|
146
|
+
const token = new GalleryImageToken(this.type.slice(0, -6), '', undefined, this.getAttribute('config'));
|
|
147
|
+
token.firstChild.safeReplaceWith(link);
|
|
148
|
+
token.append(...linkText);
|
|
149
|
+
return token;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
138
152
|
};
|
|
139
153
|
return GalleryImageToken = _classThis;
|
|
140
154
|
})();
|
package/dist/src/magicLink.js
CHANGED
|
@@ -33,12 +33,15 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.MagicLinkToken = void 0;
|
|
38
41
|
const lint_1 = require("../util/lint");
|
|
39
42
|
const string_1 = require("../util/string");
|
|
40
43
|
const rect_1 = require("../lib/rect");
|
|
41
|
-
const index_1 = require("../index");
|
|
44
|
+
const index_1 = __importDefault(require("../index"));
|
|
42
45
|
const index_2 = require("./index");
|
|
43
46
|
/* NOT FOR BROWSER */
|
|
44
47
|
const debug_1 = require("../util/debug");
|
package/dist/src/nested.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.NestedToken = void 0;
|
|
4
7
|
const lint_1 = require("../util/lint");
|
|
5
8
|
const rect_1 = require("../lib/rect");
|
|
6
9
|
const commentAndExt_1 = require("../parser/commentAndExt");
|
|
7
10
|
const braces_1 = require("../parser/braces");
|
|
8
|
-
const index_1 = require("../index");
|
|
11
|
+
const index_1 = __importDefault(require("../index"));
|
|
9
12
|
const index_2 = require("./index");
|
|
10
13
|
const ext_1 = require("./tagPair/ext");
|
|
11
14
|
const noinclude_1 = require("./nowiki/noinclude");
|
|
@@ -33,11 +33,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.CommentToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const hidden_1 = require("../../mixin/hidden");
|
|
40
|
-
const index_1 = require("../../index");
|
|
43
|
+
const index_1 = __importDefault(require("../../index"));
|
|
41
44
|
const base_1 = require("./base");
|
|
42
45
|
/* NOT FOR BROWSER */
|
|
43
46
|
const debug_1 = require("../../util/debug");
|
package/dist/src/nowiki/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.NowikiToken = void 0;
|
|
4
7
|
const lint_1 = require("../../util/lint");
|
|
5
|
-
const index_1 = require("../../index");
|
|
8
|
+
const index_1 = __importDefault(require("../../index"));
|
|
6
9
|
const base_1 = require("./base");
|
|
7
10
|
/* NOT FOR BROWSER */
|
|
8
11
|
const constants_1 = require("../../util/constants");
|
package/dist/src/nowiki/quote.js
CHANGED
|
@@ -33,11 +33,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.QuoteToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const rect_1 = require("../../lib/rect");
|
|
40
|
-
const index_1 = require("../../index");
|
|
43
|
+
const index_1 = __importDefault(require("../../index"));
|
|
41
44
|
const base_1 = require("./base");
|
|
42
45
|
/* NOT FOR BROWSER */
|
|
43
46
|
const constants_1 = require("../../util/constants");
|
package/dist/src/onlyinclude.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.OnlyincludeToken = void 0;
|
|
4
7
|
const index_1 = require("./index");
|
|
5
8
|
/* NOT FOR BROWSER */
|
|
6
9
|
const debug_1 = require("../util/debug");
|
|
7
10
|
const constants_1 = require("../util/constants");
|
|
8
|
-
const index_2 = require("../index");
|
|
11
|
+
const index_2 = __importDefault(require("../index"));
|
|
9
12
|
/* NOT FOR BROWSER END */
|
|
10
13
|
/**
|
|
11
14
|
* `<onlyinclude>` during transclusion
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ParamTagToken = void 0;
|
|
4
7
|
const lint_1 = require("../../util/lint");
|
|
5
8
|
const rect_1 = require("../../lib/rect");
|
|
6
9
|
const commentAndExt_1 = require("../../parser/commentAndExt");
|
|
7
|
-
const index_1 = require("../../index");
|
|
10
|
+
const index_1 = __importDefault(require("../../index"));
|
|
8
11
|
const index_2 = require("../index");
|
|
9
12
|
const atom_1 = require("../atom");
|
|
10
13
|
/* NOT FOR BROWSER */
|
|
@@ -53,6 +56,7 @@ class ParamTagToken extends index_2.Token {
|
|
|
53
56
|
lint(start = this.getAbsoluteIndex()) {
|
|
54
57
|
const rect = new rect_1.BoundingRect(this, start), msg = index_1.default.msg('invalid parameter of <$1>', this.name), errors = [];
|
|
55
58
|
for (const child of this.childNodes) {
|
|
59
|
+
child.setAttribute('aIndex', start);
|
|
56
60
|
const grandChildren = child.childNodes
|
|
57
61
|
.filter(({ type }) => type !== 'comment' && type !== 'include' && type !== 'noinclude');
|
|
58
62
|
if (grandChildren.some(({ type }) => type === 'ext')) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.InputboxToken = void 0;
|
|
4
7
|
const commentAndExt_1 = require("../../parser/commentAndExt");
|
|
5
8
|
const braces_1 = require("../../parser/braces");
|
|
6
|
-
const index_1 = require("../../index");
|
|
9
|
+
const index_1 = __importDefault(require("../../index"));
|
|
7
10
|
const index_2 = require("./index");
|
|
8
11
|
/* NOT FOR BROWSER */
|
|
9
12
|
const constants_1 = require("../../util/constants");
|
package/dist/src/parameter.js
CHANGED
|
@@ -33,11 +33,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.ParameterToken = void 0;
|
|
38
41
|
const string_1 = require("../util/string");
|
|
39
42
|
const lint_1 = require("../util/lint");
|
|
40
|
-
const index_1 = require("../index");
|
|
43
|
+
const index_1 = __importDefault(require("../index"));
|
|
41
44
|
const index_2 = require("./index");
|
|
42
45
|
/* NOT FOR BROWSER */
|
|
43
46
|
const debug_1 = require("../util/debug");
|
package/dist/src/pre.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.PreToken = void 0;
|
|
4
7
|
const constants_1 = require("../util/constants");
|
|
5
|
-
const index_1 = require("../index");
|
|
8
|
+
const index_1 = __importDefault(require("../index"));
|
|
6
9
|
const index_2 = require("./index");
|
|
7
10
|
const noinclude_1 = require("./nowiki/noinclude");
|
|
8
11
|
/* NOT FOR BROWSER */
|
package/dist/src/redirect.js
CHANGED
|
@@ -100,7 +100,9 @@ let RedirectToken = (() => {
|
|
|
100
100
|
}
|
|
101
101
|
/** @private */
|
|
102
102
|
lint(start = this.getAbsoluteIndex()) {
|
|
103
|
-
|
|
103
|
+
const index = start + this.#pre.length + this.firstChild.toString().length;
|
|
104
|
+
this.lastChild.setAttribute('aIndex', index);
|
|
105
|
+
return this.lastChild.lint(index);
|
|
104
106
|
}
|
|
105
107
|
/** @private */
|
|
106
108
|
print() {
|
package/dist/src/table/base.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TableBaseToken = void 0;
|
|
4
7
|
const attributesParent_1 = require("../../mixin/attributesParent");
|
|
5
|
-
const index_1 = require("../../index");
|
|
8
|
+
const index_1 = __importDefault(require("../../index"));
|
|
6
9
|
const index_2 = require("../index");
|
|
7
10
|
const syntax_1 = require("../syntax");
|
|
8
11
|
const attributes_1 = require("../attributes");
|
package/dist/src/table/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TableToken = exports.Layout = exports.isRowEnd = void 0;
|
|
4
7
|
const lint_1 = require("../../util/lint");
|
|
5
8
|
const debug_1 = require("../../util/debug");
|
|
6
9
|
const rect_1 = require("../../lib/rect");
|
|
7
|
-
const index_1 = require("../../index");
|
|
10
|
+
const index_1 = __importDefault(require("../../index"));
|
|
8
11
|
const trBase_1 = require("./trBase");
|
|
9
12
|
const syntax_1 = require("../syntax");
|
|
10
13
|
/* NOT FOR BROWSER */
|
|
@@ -153,7 +156,8 @@ class TableToken extends trBase_1.TrBaseToken {
|
|
|
153
156
|
*/
|
|
154
157
|
getLayout(stop) {
|
|
155
158
|
const rows = this.getAllRows(), { length } = rows, layout = new Layout(...emptyArray(length, () => []));
|
|
156
|
-
for (
|
|
159
|
+
for (let i = 0; i < layout.length; i++) {
|
|
160
|
+
const rowLayout = layout[i];
|
|
157
161
|
/* NOT FOR BROWSER */
|
|
158
162
|
if (i > (stop?.row ?? stop?.y ?? NaN)) {
|
|
159
163
|
break;
|
|
@@ -573,7 +577,10 @@ class TableToken extends trBase_1.TrBaseToken {
|
|
|
573
577
|
* @param token 表格或表格行
|
|
574
578
|
*/
|
|
575
579
|
const filter = (token) => token.childNodes.filter((0, debug_1.isToken)('table-inter'));
|
|
576
|
-
const { childNodes } = this, tr = childNodes.filter((0, debug_1.isToken)('tr')), newOpt = {
|
|
580
|
+
const { childNodes } = this, tr = childNodes.filter((0, debug_1.isToken)('tr')), newOpt = {
|
|
581
|
+
...opt,
|
|
582
|
+
nowrap: true,
|
|
583
|
+
};
|
|
577
584
|
return `${[this, ...tr].flatMap(filter) // eslint-disable-line es-x/no-array-prototype-flat
|
|
578
585
|
.map(token => token.toHtmlInternal(newOpt).trim())
|
|
579
586
|
.join(' ')}<table${childNodes[1].toHtmlInternal()}>${opt?.nowrap ? ' ' : '\n'}<tbody>${super.toHtmlInternal(opt)}${(0, html_1.html)(tr, '', opt)}</tbody></table>`;
|
package/dist/src/table/td.js
CHANGED
|
@@ -33,12 +33,15 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.createTd = exports.TdToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const constants_1 = require("../../util/constants");
|
|
40
43
|
const rect_1 = require("../../lib/rect");
|
|
41
|
-
const index_1 = require("../../index");
|
|
44
|
+
const index_1 = __importDefault(require("../../index"));
|
|
42
45
|
const index_2 = require("../index");
|
|
43
46
|
const base_1 = require("./base");
|
|
44
47
|
/* NOT FOR BROWSER */
|
package/dist/src/tagPair/ext.js
CHANGED
|
@@ -33,11 +33,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.ExtToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const rect_1 = require("../../lib/rect");
|
|
40
|
-
const index_1 = require("../../index");
|
|
43
|
+
const index_1 = __importDefault(require("../../index"));
|
|
41
44
|
const attributesParent_1 = require("../../mixin/attributesParent");
|
|
42
45
|
const index_2 = require("../index");
|
|
43
46
|
const index_3 = require("./index");
|
|
@@ -97,7 +100,11 @@ let ExtToken = (() => {
|
|
|
97
100
|
constructor(name, attr, inner, closed, config = index_1.default.getConfig(), include = false, accum = []) {
|
|
98
101
|
const lcName = name.toLowerCase(),
|
|
99
102
|
// @ts-expect-error abstract class
|
|
100
|
-
attrToken = new attributes_1.AttributesToken(!attr || /^\s/u.test(attr) ? attr : ` ${attr}`, 'ext-attrs', lcName, config, accum), newConfig = {
|
|
103
|
+
attrToken = new attributes_1.AttributesToken(!attr || /^\s/u.test(attr) ? attr : ` ${attr}`, 'ext-attrs', lcName, config, accum), newConfig = {
|
|
104
|
+
...config,
|
|
105
|
+
ext: del(config.ext, lcName),
|
|
106
|
+
excludes: [...config.excludes ?? []],
|
|
107
|
+
};
|
|
101
108
|
let innerToken;
|
|
102
109
|
switch (lcName) {
|
|
103
110
|
case 'tab':
|
|
@@ -203,11 +210,16 @@ let ExtToken = (() => {
|
|
|
203
210
|
case 'nowiki':
|
|
204
211
|
return (0, string_1.newline)(lastChild.toHtmlInternal());
|
|
205
212
|
case 'pre':
|
|
206
|
-
return `<pre${firstChild.toHtmlInternal()}>${(0, string_1.newline)(lastChild.toHtmlInternal({
|
|
213
|
+
return `<pre${firstChild.toHtmlInternal()}>${(0, string_1.newline)(lastChild.toHtmlInternal({
|
|
214
|
+
...opt,
|
|
215
|
+
nowrap: false,
|
|
216
|
+
}))}</pre>`;
|
|
207
217
|
case 'poem':
|
|
208
218
|
firstChild.classList.add('poem');
|
|
209
|
-
return `<div${firstChild.toHtmlInternal()}>${lastChild.toHtmlInternal({
|
|
210
|
-
|
|
219
|
+
return `<div${firstChild.toHtmlInternal()}>${lastChild.toHtmlInternal({
|
|
220
|
+
...opt,
|
|
221
|
+
nowrap: false,
|
|
222
|
+
}).replace(/(?<!^|<hr>)\n(?!$)/gu, '<br>\n')
|
|
211
223
|
.replace(/^ +/gmu, p => ' '.repeat(p.length))}</div>`;
|
|
212
224
|
case 'gallery': {
|
|
213
225
|
const caption = firstChild.getAttrToken('caption'), perrow = parseInt(String(firstChild.getAttr('perrow'))), mode = firstChild.getAttr('mode'), nolines = typeof mode === 'string' && mode.toLowerCase() === 'nolines', padding = nolines ? 9 : 43;
|
|
@@ -33,12 +33,15 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.IncludeToken = void 0;
|
|
38
41
|
const lint_1 = require("../../util/lint");
|
|
39
42
|
const rect_1 = require("../../lib/rect");
|
|
40
43
|
const hidden_1 = require("../../mixin/hidden");
|
|
41
|
-
const index_1 = require("../../index");
|
|
44
|
+
const index_1 = __importDefault(require("../../index"));
|
|
42
45
|
const index_2 = require("./index");
|
|
43
46
|
/* NOT FOR BROWSER */
|
|
44
47
|
const debug_1 = require("../../util/debug");
|
|
@@ -33,13 +33,16 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
}
|
|
34
34
|
return useValue ? value : void 0;
|
|
35
35
|
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.TagPairToken = void 0;
|
|
38
41
|
const index_1 = require("../index");
|
|
39
42
|
/* NOT FOR BROWSER */
|
|
40
43
|
const constants_1 = require("../../util/constants");
|
|
41
44
|
const fixed_1 = require("../../mixin/fixed");
|
|
42
|
-
const index_2 = require("../../index");
|
|
45
|
+
const index_2 = __importDefault(require("../../index"));
|
|
43
46
|
/* NOT FOR BROWSER END */
|
|
44
47
|
/**
|
|
45
48
|
* Paired tags
|
package/dist/src/transclude.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TranscludeToken = void 0;
|
|
4
7
|
const string_1 = require("../util/string");
|
|
@@ -11,7 +14,7 @@ const parameter_1 = require("./parameter");
|
|
|
11
14
|
const atom_1 = require("./atom");
|
|
12
15
|
const syntax_1 = require("./syntax");
|
|
13
16
|
/* NOT FOR BROWSER */
|
|
14
|
-
const index_2 = require("../index");
|
|
17
|
+
const index_2 = __importDefault(require("../index"));
|
|
15
18
|
const basicMagicWords = new Map([['=', '='], ['!', '|']]);
|
|
16
19
|
/**
|
|
17
20
|
* template or magic word
|
|
@@ -122,7 +125,8 @@ class TranscludeToken extends index_1.Token {
|
|
|
122
125
|
}
|
|
123
126
|
const templateLike = this.isTemplate();
|
|
124
127
|
let i = 1;
|
|
125
|
-
for (
|
|
128
|
+
for (let j = 0; j < parts.length; j++) {
|
|
129
|
+
const part = parts[j];
|
|
126
130
|
if (!(templateLike || this.name === 'switch' && j > 0 || this.name === 'tag' && j > 1)) {
|
|
127
131
|
part[0] = part.join('=');
|
|
128
132
|
part.length = 1;
|
|
@@ -169,8 +173,9 @@ class TranscludeToken extends index_1.Token {
|
|
|
169
173
|
}
|
|
170
174
|
/** 获取模板或模块名 */
|
|
171
175
|
#getTitle() {
|
|
172
|
-
const isTemplate = this.type === 'template';
|
|
173
|
-
|
|
176
|
+
const isTemplate = this.type === 'template', title = this.normalizeTitle(this.childNodes[isTemplate ? 0 : 1].toString(true), isTemplate ? 10 : 828, true);
|
|
177
|
+
title.fragment = undefined;
|
|
178
|
+
return title;
|
|
174
179
|
}
|
|
175
180
|
/**
|
|
176
181
|
* Get the module name and module function name
|
|
@@ -328,11 +333,11 @@ class TranscludeToken extends index_1.Token {
|
|
|
328
333
|
/* NOT FOR BROWSER END */
|
|
329
334
|
for (let i = added ? args.indexOf(addedToken) : addedToken - 1; i < args.length; i++) {
|
|
330
335
|
const token = args[i], { name } = token, newName = String(i + 1);
|
|
331
|
-
if (name !== newName) {
|
|
336
|
+
if (name !== newName || token === addedToken) {
|
|
332
337
|
token.setAttribute('name', newName);
|
|
333
338
|
this.getArgs(newName, false, false).add(token);
|
|
334
339
|
/* NOT FOR BROWSER */
|
|
335
|
-
if (name) {
|
|
340
|
+
if (name && token !== addedToken) {
|
|
336
341
|
this.getArgs(name, false, false).delete(token);
|
|
337
342
|
}
|
|
338
343
|
}
|
|
@@ -471,7 +476,7 @@ class TranscludeToken extends index_1.Token {
|
|
|
471
476
|
const [first, ...cloned] = this.cloneChildNodes(), config = this.getAttribute('config');
|
|
472
477
|
return debug_1.Shadow.run(() => {
|
|
473
478
|
// @ts-expect-error abstract class
|
|
474
|
-
const token = new TranscludeToken(this.type === 'template' ? 'T' : first.text()
|
|
479
|
+
const token = new TranscludeToken(this.type === 'template' ? 'T' : `${first.text()}:`, [], config);
|
|
475
480
|
if (this.#raw) {
|
|
476
481
|
token.setModifier(this.modifier);
|
|
477
482
|
}
|
|
@@ -479,7 +484,11 @@ class TranscludeToken extends index_1.Token {
|
|
|
479
484
|
token.setAttribute('modifier', this.modifier);
|
|
480
485
|
}
|
|
481
486
|
token.firstChild.safeReplaceWith(first);
|
|
487
|
+
if (this.type === 'magic-word') {
|
|
488
|
+
token.removeAt(1);
|
|
489
|
+
}
|
|
482
490
|
token.append(...cloned);
|
|
491
|
+
token.afterBuild();
|
|
483
492
|
return token;
|
|
484
493
|
});
|
|
485
494
|
}
|
package/dist/util/debug.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.undo = exports.
|
|
3
|
+
exports.undo = exports.mixin = exports.setChildNodes = exports.isToken = exports.Shadow = void 0;
|
|
4
4
|
exports.Shadow = {
|
|
5
5
|
running: false,
|
|
6
6
|
/** @private */
|
|
@@ -65,18 +65,6 @@ const mixin = (target, source) => {
|
|
|
65
65
|
};
|
|
66
66
|
exports.mixin = mixin;
|
|
67
67
|
/* NOT FOR BROWSER */
|
|
68
|
-
/* istanbul ignore next */
|
|
69
|
-
/**
|
|
70
|
-
* 定制TypeError消息
|
|
71
|
-
* @param {Function} Constructor 类
|
|
72
|
-
* @param method
|
|
73
|
-
* @param args 可接受的参数类型
|
|
74
|
-
* @throws `TypeError`
|
|
75
|
-
*/
|
|
76
|
-
const typeError = ({ name }, method, ...args) => {
|
|
77
|
-
throw new TypeError(`${name}.${method} method only accepts ${args.join('、')} as input parameters!`);
|
|
78
|
-
};
|
|
79
|
-
exports.typeError = typeError;
|
|
80
68
|
/**
|
|
81
69
|
* 撤销最近一次Mutation
|
|
82
70
|
* @param e 事件
|
package/dist/util/diff.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.info = exports.error = exports.diff = exports.cmd = void 0;
|
|
4
|
-
const
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
5
8
|
const child_process_1 = require("child_process");
|
|
6
|
-
const chalk = require("chalk");
|
|
7
9
|
/* istanbul ignore next */
|
|
8
10
|
process.on('unhandledRejection', e => {
|
|
9
11
|
console.error(e);
|
|
@@ -61,7 +63,7 @@ const diff = async (oldStr, newStr, uid) => {
|
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
63
65
|
const oldFile = `diffOld${uid}`, newFile = `diffNew${uid}`;
|
|
64
|
-
await Promise.all([
|
|
66
|
+
await Promise.all([promises_1.default.writeFile(oldFile, oldStr), promises_1.default.writeFile(newFile, newStr)]);
|
|
65
67
|
const stdout = await (0, exports.cmd)('git', [
|
|
66
68
|
'diff',
|
|
67
69
|
'--color-words=[\xC0-\xFF][\x80-\xBF]+|<?/?\\w+/?>?|[^[:space:]]',
|
|
@@ -71,18 +73,30 @@ const diff = async (oldStr, newStr, uid) => {
|
|
|
71
73
|
newFile,
|
|
72
74
|
]);
|
|
73
75
|
console.log(stdout?.split('\n').slice(4).join('\n'));
|
|
74
|
-
await Promise.all([
|
|
76
|
+
await Promise.all([promises_1.default.unlink(oldFile), promises_1.default.unlink(newFile)]);
|
|
75
77
|
};
|
|
76
78
|
exports.diff = diff;
|
|
77
79
|
/* istanbul ignore next */
|
|
78
80
|
/** @implements */
|
|
79
81
|
const error = (msg, ...args) => {
|
|
80
|
-
|
|
82
|
+
try {
|
|
83
|
+
const chalk = require('chalk');
|
|
84
|
+
console.error(chalk.red(msg), ...args);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
console.error(msg, ...args);
|
|
88
|
+
}
|
|
81
89
|
};
|
|
82
90
|
exports.error = error;
|
|
83
91
|
/* istanbul ignore next */
|
|
84
92
|
/** @implements */
|
|
85
93
|
const info = (msg, ...args) => {
|
|
86
|
-
|
|
94
|
+
try {
|
|
95
|
+
const chalk = require('chalk');
|
|
96
|
+
console.info(chalk.green(msg), ...args);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
console.info(msg, ...args);
|
|
100
|
+
}
|
|
87
101
|
};
|
|
88
102
|
exports.info = info;
|
package/dist/util/lint.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.cache = exports.generateForSelf = exports.generateForChild = exports.getEndPos = void 0;
|
|
4
7
|
const debug_1 = require("./debug");
|
|
5
8
|
const rect_1 = require("../lib/rect");
|
|
6
|
-
const index_1 = require("../index");
|
|
9
|
+
const index_1 = __importDefault(require("../index"));
|
|
7
10
|
/**
|
|
8
11
|
* 计算结束位置
|
|
9
12
|
* @param top 起始行
|
package/dist/util/string.js
CHANGED
|
@@ -40,8 +40,11 @@ const decodeHtml = (str) => {
|
|
|
40
40
|
/* NOT FOR BROWSER ONLY */
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
42
42
|
if (typeof process === 'object' && typeof process.versions?.node === 'string') {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
try {
|
|
44
|
+
const { decodeHTMLStrict } = require('entities');
|
|
45
|
+
return decodeHTMLStrict(str).replace(/\xA0/gu, ' ');
|
|
46
|
+
}
|
|
47
|
+
catch { }
|
|
45
48
|
}
|
|
46
49
|
/* istanbul ignore next */
|
|
47
50
|
/* NOT FOR BROWSER ONLY END */
|