wikiparser-node 1.11.0 → 1.11.1
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/token.js +2 -2
- package/dist/index.js +1 -1
- package/dist/lib/node.js +1 -2
- package/dist/src/imageParameter.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/link/file.js +2 -2
- package/package.json +2 -15
package/dist/addon/token.js
CHANGED
|
@@ -289,11 +289,11 @@ const expand = (wikitext, config, include, context, accum = []) => {
|
|
|
289
289
|
}
|
|
290
290
|
return token;
|
|
291
291
|
};
|
|
292
|
-
index_2.Token.prototype.expand = /** @implements */ function (
|
|
292
|
+
index_2.Token.prototype.expand = /** @implements */ function () {
|
|
293
293
|
if (this.type !== 'root') {
|
|
294
294
|
throw new Error('Only root token can be expanded!');
|
|
295
295
|
}
|
|
296
|
-
return debug_1.Shadow.run(() => expand(this.toString(), this.getAttribute('config'), this.getAttribute('include')
|
|
296
|
+
return debug_1.Shadow.run(() => expand(this.toString(), this.getAttribute('config'), this.getAttribute('include')).parse());
|
|
297
297
|
};
|
|
298
298
|
index_2.Token.prototype.solveConst = /** @implements */ function () {
|
|
299
299
|
if (this.type !== 'root') {
|
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ const Parser = {
|
|
|
159
159
|
},
|
|
160
160
|
/** @implements */
|
|
161
161
|
async clearCache() {
|
|
162
|
-
const promise = (0, diff_1.cmd)('npm', ['run', 'build:core']), entries = [
|
|
162
|
+
const promise = (0, diff_1.cmd)('npm', ['--prefix', path.join(__dirname, '..'), 'run', 'build:core']), entries = [
|
|
163
163
|
...Object.entries(constants_1.classes),
|
|
164
164
|
...Object.entries(constants_1.mixins),
|
|
165
165
|
...Object.entries(constants_1.parsers),
|
package/dist/lib/node.js
CHANGED
|
@@ -13,7 +13,7 @@ function validate(key, val, config, halfParsed, ext) {
|
|
|
13
13
|
let value = val.replace(key === 'link' ? /\0\d+[tq]\x7F/gu : /\0\d+t\x7F/gu, '').trim();
|
|
14
14
|
switch (key) {
|
|
15
15
|
case 'width':
|
|
16
|
-
return !value || /^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(value);
|
|
16
|
+
return !value && Boolean(val) || /^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(value);
|
|
17
17
|
case 'link': {
|
|
18
18
|
if (!value) {
|
|
19
19
|
return val;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -731,9 +731,9 @@ class Token extends element_1.AstElement {
|
|
|
731
731
|
* 展开模板
|
|
732
732
|
* @param context 模板调用环境
|
|
733
733
|
*/
|
|
734
|
-
expand(
|
|
734
|
+
expand() {
|
|
735
735
|
require('../addon/token');
|
|
736
|
-
return this.expand(
|
|
736
|
+
return this.expand();
|
|
737
737
|
}
|
|
738
738
|
/** 解析部分魔术字 */
|
|
739
739
|
solveConst() {
|
package/dist/src/link/file.js
CHANGED
|
@@ -283,9 +283,9 @@ class FileToken extends base_1.LinkBaseToken {
|
|
|
283
283
|
if (value === true && free) {
|
|
284
284
|
this.typeError('setValue', 'String');
|
|
285
285
|
}
|
|
286
|
-
const parameter = debug_1.Shadow.run(
|
|
286
|
+
const parameter = debug_1.Shadow.run(() =>
|
|
287
287
|
// @ts-expect-error abstract class
|
|
288
|
-
|
|
288
|
+
new imageParameter_1.ImageParameterToken(syntax.replace('$1', key === 'width' ? '1' : ''), this.extension, config));
|
|
289
289
|
if (free) {
|
|
290
290
|
const { childNodes } = index_1.default.parse(value, this.getAttribute('include'), undefined, config);
|
|
291
291
|
parameter.replaceChildren(...childNodes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikiparser-node",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "A Node.js parser for MediaWiki markup with AST",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -48,23 +48,10 @@
|
|
|
48
48
|
"chalk": "^4.1.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@bhsd/common": "^0.0.0",
|
|
51
52
|
"@codemirror/lint": "^6.8.0",
|
|
52
|
-
"@stylistic/eslint-plugin": "^2.3.0",
|
|
53
53
|
"@types/node": "^20.11.6",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
55
|
-
"@typescript-eslint/parser": "^7.15.0",
|
|
56
|
-
"eslint": "^8.56.0",
|
|
57
|
-
"eslint-plugin-es-x": "^8.0.0",
|
|
58
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
59
|
-
"eslint-plugin-jsdoc": "^48.5.2",
|
|
60
|
-
"eslint-plugin-json-es": "^1.6.0",
|
|
61
|
-
"eslint-plugin-markdown": "^4.0.1",
|
|
62
|
-
"eslint-plugin-n": "^17.9.0",
|
|
63
|
-
"eslint-plugin-promise": "^6.2.0",
|
|
64
|
-
"eslint-plugin-regexp": "^2.6.0",
|
|
65
|
-
"eslint-plugin-unicorn": "^54.0.0",
|
|
66
54
|
"monaco-editor": "^0.50.0",
|
|
67
|
-
"typescript": "^5.5.3",
|
|
68
55
|
"v8r": "^3.0.0"
|
|
69
56
|
},
|
|
70
57
|
"engines": {
|