wikilint 2.48.1 → 3.0.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 +1 -1
- package/data/signatures.json +2 -2
- package/dist/base.d.mts +3 -2
- package/dist/base.d.ts +3 -2
- package/dist/base.js +1 -0
- package/dist/base.mjs +2 -1
- package/dist/bin/config.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +17 -11
- package/dist/internal.d.ts +1 -0
- package/dist/lib/document.d.ts +4 -4
- package/dist/lib/lintConfig.js +1 -0
- package/dist/lib/lsp.js +7 -4
- package/dist/lib/node.d.ts +0 -4
- package/dist/lib/node.js +8 -0
- package/dist/map.d.ts +2 -1
- package/dist/parser/commentAndExt.js +1 -2
- package/dist/parser/hrAndDoubleUnderscore.js +3 -2
- package/dist/parser/table.js +2 -1
- package/dist/src/arg.d.ts +1 -1
- package/dist/src/arg.js +1 -1
- package/dist/src/attributes.d.ts +4 -3
- package/dist/src/converter.d.ts +1 -1
- package/dist/src/converter.js +1 -1
- package/dist/src/converterRule.d.ts +1 -1
- package/dist/src/converterRule.js +1 -1
- package/dist/src/extLink.d.ts +1 -1
- package/dist/src/extLink.js +1 -1
- package/dist/src/index.js +54 -14
- package/dist/src/link/category.d.ts +1 -1
- package/dist/src/link/category.js +1 -1
- package/dist/src/link/index.d.ts +1 -1
- package/dist/src/link/index.js +1 -1
- package/dist/src/link/redirectTarget.d.ts +1 -1
- package/dist/src/link/redirectTarget.js +1 -1
- package/dist/src/magicLink.d.ts +4 -3
- package/dist/src/magicLink.js +1 -1
- package/dist/src/multiLine/gallery.d.ts +4 -4
- package/dist/src/multiLine/imagemap.d.ts +5 -3
- package/dist/src/multiLine/imagemap.js +1 -1
- package/dist/src/nested.d.ts +1 -1
- package/dist/src/nested.js +1 -1
- package/dist/src/nowiki/list.js +6 -3
- package/dist/src/nowiki/listBase.d.ts +24 -0
- package/dist/src/nowiki/listBase.js +104 -0
- package/dist/src/paramLine.d.ts +1 -1
- package/dist/src/paramLine.js +1 -1
- package/dist/src/pre.d.ts +5 -3
- package/dist/src/redirect.d.ts +1 -1
- package/dist/src/redirect.js +1 -1
- package/dist/src/singleLine/charinsertLine.d.ts +1 -1
- package/dist/src/singleLine/charinsertLine.js +1 -1
- package/dist/src/table/index.d.ts +2 -2
- package/dist/src/table/index.js +1 -1
- package/dist/src/table/tr.d.ts +1 -1
- package/dist/src/table/tr.js +1 -1
- package/dist/src/tag/index.d.ts +7 -5
- package/dist/src/tag/index.js +9 -4
- package/dist/src/tagPair/ext.js +1 -1
- package/dist/src/transclude.d.ts +1 -1
- package/dist/src/transclude.js +1 -1
- package/dist/util/debug.js +7 -1
- package/i18n/en.json +1 -0
- package/i18n/zh-hans.json +1 -0
- package/i18n/zh-hant.json +1 -0
- package/package.json +6 -6
|
@@ -7,7 +7,7 @@ import type { Token, AtomToken } from '../../internal';
|
|
|
7
7
|
* target of a redirect
|
|
8
8
|
*
|
|
9
9
|
* 重定向目标
|
|
10
|
-
* @classdesc `{childNodes: [AtomToken, ?
|
|
10
|
+
* @classdesc `{childNodes: [AtomToken, NoincludeToken?]}`
|
|
11
11
|
*/
|
|
12
12
|
export declare abstract class RedirectTargetToken extends LinkBaseToken {
|
|
13
13
|
readonly childNodes: readonly [AtomToken] | readonly [AtomToken, NoincludeToken];
|
|
@@ -12,7 +12,7 @@ const noinclude_1 = require("../nowiki/noinclude");
|
|
|
12
12
|
* target of a redirect
|
|
13
13
|
*
|
|
14
14
|
* 重定向目标
|
|
15
|
-
* @classdesc `{childNodes: [AtomToken, ?
|
|
15
|
+
* @classdesc `{childNodes: [AtomToken, NoincludeToken?]}`
|
|
16
16
|
*/
|
|
17
17
|
class RedirectTargetToken extends base_1.LinkBaseToken {
|
|
18
18
|
get type() {
|
package/dist/src/magicLink.d.ts
CHANGED
|
@@ -3,17 +3,18 @@ import { Token } from './index';
|
|
|
3
3
|
import type { LintError } from '../base';
|
|
4
4
|
import type { AstText, CommentToken, IncludeToken, NoincludeToken, TranscludeToken } from '../internal';
|
|
5
5
|
declare type ExtLinkTypes = 'free-ext-link' | 'ext-link-url' | 'magic-link';
|
|
6
|
+
declare type Child = CommentToken | IncludeToken | NoincludeToken | TranscludeToken;
|
|
6
7
|
/**
|
|
7
8
|
* free external link
|
|
8
9
|
*
|
|
9
10
|
* 自由外链
|
|
10
|
-
* @classdesc `{childNodes: (AstText|CommentToken|IncludeToken|NoincludeToken)[]}`
|
|
11
|
+
* @classdesc `{childNodes: (AstText|CommentToken|IncludeToken|NoincludeToken|TranscludeToken)[]}`
|
|
11
12
|
*/
|
|
12
13
|
export declare abstract class MagicLinkToken extends Token {
|
|
13
14
|
#private;
|
|
14
|
-
readonly childNodes: readonly (AstText |
|
|
15
|
+
readonly childNodes: readonly (AstText | Child)[];
|
|
15
16
|
abstract get firstChild(): AstText | TranscludeToken;
|
|
16
|
-
abstract get lastChild(): AstText |
|
|
17
|
+
abstract get lastChild(): AstText | Child;
|
|
17
18
|
get type(): ExtLinkTypes;
|
|
18
19
|
/**
|
|
19
20
|
* text of the link
|
package/dist/src/magicLink.js
CHANGED
|
@@ -15,7 +15,7 @@ const spaceRegex = new RegExp(`${space}+`, 'gu');
|
|
|
15
15
|
* free external link
|
|
16
16
|
*
|
|
17
17
|
* 自由外链
|
|
18
|
-
* @classdesc `{childNodes: (AstText|CommentToken|IncludeToken|NoincludeToken)[]}`
|
|
18
|
+
* @classdesc `{childNodes: (AstText|CommentToken|IncludeToken|NoincludeToken|TranscludeToken)[]}`
|
|
19
19
|
*/
|
|
20
20
|
class MagicLinkToken extends index_2.Token {
|
|
21
21
|
#type;
|
|
@@ -3,7 +3,7 @@ import { GalleryImageToken } from '../link/galleryImage';
|
|
|
3
3
|
import { CommentLineToken } from '../nowiki/commentLine';
|
|
4
4
|
import type { Config, LintError } from '../../base';
|
|
5
5
|
import type { AstText, Token } from '../../internal';
|
|
6
|
-
declare type Child = GalleryImageToken | CommentLineToken
|
|
6
|
+
declare type Child = GalleryImageToken | CommentLineToken;
|
|
7
7
|
/**
|
|
8
8
|
* `<gallery>`
|
|
9
9
|
* @classdesc `{childNodes: (GalleryImageToken|CommentLineToken|AstText)[]}`
|
|
@@ -11,9 +11,9 @@ declare type Child = GalleryImageToken | CommentLineToken | AstText;
|
|
|
11
11
|
export declare abstract class GalleryToken extends MultiLineToken {
|
|
12
12
|
#private;
|
|
13
13
|
readonly name: 'gallery';
|
|
14
|
-
readonly childNodes: readonly Child[];
|
|
15
|
-
abstract get firstChild(): Child | undefined;
|
|
16
|
-
abstract get lastChild(): Child | undefined;
|
|
14
|
+
readonly childNodes: readonly (AstText | Child)[];
|
|
15
|
+
abstract get firstChild(): AstText | Child | undefined;
|
|
16
|
+
abstract get lastChild(): AstText | Child | undefined;
|
|
17
17
|
/** @param inner 标签内部wikitext */
|
|
18
18
|
constructor(inner?: string, config?: Config, accum?: Token[]);
|
|
19
19
|
}
|
|
@@ -5,17 +5,19 @@ import { GalleryImageToken } from '../link/galleryImage';
|
|
|
5
5
|
import { ImagemapLinkToken } from '../singleLine/imagemapLink';
|
|
6
6
|
import type { LintError } from '../../base';
|
|
7
7
|
import type { AstText, Token } from '../../internal';
|
|
8
|
+
declare type Child = GalleryImageToken | CommentLineToken | ImagemapLinkToken;
|
|
8
9
|
/**
|
|
9
10
|
* `<imagemap>`
|
|
10
|
-
* @classdesc `{childNodes:
|
|
11
|
+
* @classdesc `{childNodes: (GalleryImageToken|CommentLineToken|ImagemapLinkToken|AstText)[]]}`
|
|
11
12
|
*/
|
|
12
13
|
export declare abstract class ImagemapToken extends MultiLineToken {
|
|
13
14
|
readonly name: 'imagemap';
|
|
14
|
-
readonly childNodes: readonly (
|
|
15
|
+
readonly childNodes: readonly (Child | AstText)[];
|
|
15
16
|
abstract get firstChild(): GalleryImageToken | CommentLineToken | undefined;
|
|
16
|
-
abstract get lastChild():
|
|
17
|
+
abstract get lastChild(): Child | AstText | undefined;
|
|
17
18
|
/** 图片 */
|
|
18
19
|
get image(): GalleryImageToken | undefined;
|
|
19
20
|
/** @param inner 标签内部wikitext */
|
|
20
21
|
constructor(inner?: string, config?: Parser.Config, accum?: Token[]);
|
|
21
22
|
}
|
|
23
|
+
export {};
|
|
@@ -14,7 +14,7 @@ const galleryImage_1 = require("../link/galleryImage");
|
|
|
14
14
|
const imagemapLink_1 = require("../singleLine/imagemapLink");
|
|
15
15
|
/**
|
|
16
16
|
* `<imagemap>`
|
|
17
|
-
* @classdesc `{childNodes:
|
|
17
|
+
* @classdesc `{childNodes: (GalleryImageToken|CommentLineToken|ImagemapLinkToken|AstText)[]]}`
|
|
18
18
|
*/
|
|
19
19
|
class ImagemapToken extends index_2.MultiLineToken {
|
|
20
20
|
/** 图片 */
|
package/dist/src/nested.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare type Child = ExtToken | NoincludeToken | CommentToken | IncludeToken | A
|
|
|
8
8
|
* extension tag that has a nested structure
|
|
9
9
|
*
|
|
10
10
|
* 嵌套式的扩展标签
|
|
11
|
-
* @classdesc `{childNodes: (ExtToken|NoincludeToken|CommentToken)[]}`
|
|
11
|
+
* @classdesc `{childNodes: (ExtToken|NoincludeToken|CommentToken|IncludeToken|ArgToken|TranscludeToken)[]}`
|
|
12
12
|
*/
|
|
13
13
|
export declare abstract class NestedToken extends Token {
|
|
14
14
|
#private;
|
package/dist/src/nested.js
CHANGED
|
@@ -20,7 +20,7 @@ const childTypes = new Set(['comment', 'include', 'arg', 'template', 'magic-word
|
|
|
20
20
|
* extension tag that has a nested structure
|
|
21
21
|
*
|
|
22
22
|
* 嵌套式的扩展标签
|
|
23
|
-
* @classdesc `{childNodes: (ExtToken|NoincludeToken|CommentToken)[]}`
|
|
23
|
+
* @classdesc `{childNodes: (ExtToken|NoincludeToken|CommentToken|IncludeToken|ArgToken|TranscludeToken)[]}`
|
|
24
24
|
*/
|
|
25
25
|
class NestedToken extends index_2.Token {
|
|
26
26
|
#tags;
|
package/dist/src/nowiki/list.js
CHANGED
|
@@ -22,11 +22,14 @@ class ListToken extends listBase_1.ListBaseToken {
|
|
|
22
22
|
LINT: {
|
|
23
23
|
const rule = 'syntax-like', s = index_1.default.lintConfig.getSeverity(rule, 'redirect'), { innerText } = this;
|
|
24
24
|
if (s && innerText === '#') {
|
|
25
|
-
// eslint-disable-next-line prefer-const
|
|
26
25
|
let { nextSibling } = this;
|
|
26
|
+
PRINT: if (nextSibling?.is('list-range')) {
|
|
27
|
+
nextSibling = nextSibling.firstChild;
|
|
28
|
+
}
|
|
27
29
|
if (nextSibling?.type === 'text' && linkTypes.has(nextSibling.nextSibling?.type)) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
31
|
+
/^redirect[^\S\n]*(?::[^\S\n]*)?$/iu;
|
|
32
|
+
const re = new RegExp(String.raw `^(?:${this.getAttribute('config').redirection.join('|')})[^\S\n]*(?::[^\S\n]*)?$`, 'iu');
|
|
30
33
|
if (re.test(`#${nextSibling.data}`)) {
|
|
31
34
|
const e = (0, lint_1.generateForSelf)(nextSibling, { start: start + 1 }, rule, 'redirect-like', s);
|
|
32
35
|
e.startIndex--;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
+
import { AstText } from '../../lib/text';
|
|
2
|
+
import { Token } from '../index';
|
|
1
3
|
import { NowikiBaseToken } from './base';
|
|
4
|
+
import type { DdToken, ListToken } from '../../internal';
|
|
5
|
+
export interface ListRangeToken extends Token {
|
|
6
|
+
readonly type: 'list-range';
|
|
7
|
+
readonly previousSibling: ListToken | DdToken;
|
|
8
|
+
readonly nextSibling: DdToken | AstText | undefined;
|
|
9
|
+
}
|
|
2
10
|
/** `;:*#` */
|
|
3
11
|
export declare abstract class ListBaseToken extends NowikiBaseToken {
|
|
4
12
|
abstract get type(): 'dd' | 'list';
|
|
13
|
+
/** whether to contain `;` / 是否包含`;` */
|
|
14
|
+
get dt(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* number of indentation
|
|
17
|
+
*
|
|
18
|
+
* 缩进数
|
|
19
|
+
* @since v1.16.5
|
|
20
|
+
*/
|
|
21
|
+
get indent(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Get the range of the list
|
|
24
|
+
*
|
|
25
|
+
* 获取列表行的范围
|
|
26
|
+
* @throws `Error` if the token has no parent node
|
|
27
|
+
*/
|
|
28
|
+
getRange(): ListRangeToken;
|
|
5
29
|
}
|
|
@@ -1,8 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ListBaseToken = void 0;
|
|
4
|
+
const debug_1 = require("../../util/debug");
|
|
5
|
+
const text_1 = require("../../lib/text");
|
|
6
|
+
const index_1 = require("../index");
|
|
4
7
|
const base_1 = require("./base");
|
|
5
8
|
/** `;:*#` */
|
|
6
9
|
class ListBaseToken extends base_1.NowikiBaseToken {
|
|
10
|
+
/** whether to contain `;` / 是否包含`;` */
|
|
11
|
+
get dt() {
|
|
12
|
+
PRINT: return this.innerText.includes(';');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* number of indentation
|
|
16
|
+
*
|
|
17
|
+
* 缩进数
|
|
18
|
+
* @since v1.16.5
|
|
19
|
+
*/
|
|
20
|
+
get indent() {
|
|
21
|
+
PRINT: return this.innerText.split(':').length - 1;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the range of the list
|
|
25
|
+
*
|
|
26
|
+
* 获取列表行的范围
|
|
27
|
+
* @throws `Error` if the token has no parent node
|
|
28
|
+
*/
|
|
29
|
+
getRange() {
|
|
30
|
+
PRINT: {
|
|
31
|
+
const { parentNode } = this;
|
|
32
|
+
if (!parentNode) {
|
|
33
|
+
throw new Error('There is no parent node!');
|
|
34
|
+
}
|
|
35
|
+
let { nextSibling } = this;
|
|
36
|
+
if (nextSibling?.is('list-range')) {
|
|
37
|
+
return nextSibling;
|
|
38
|
+
}
|
|
39
|
+
const { dt, type } = this;
|
|
40
|
+
let nDt = 0;
|
|
41
|
+
while (nextSibling && (nextSibling.type !== 'text' || !nextSibling.data.includes('\n'))) {
|
|
42
|
+
if (type === 'list') {
|
|
43
|
+
if (nextSibling.is('dd')) {
|
|
44
|
+
nDt -= nextSibling.indent;
|
|
45
|
+
if (dt && nDt < 0) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (nextSibling.is('list') && nextSibling.dt) {
|
|
50
|
+
nDt++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (nextSibling.is('dd')) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
({ nextSibling } = nextSibling);
|
|
57
|
+
}
|
|
58
|
+
let start, end, contents;
|
|
59
|
+
if (nextSibling && nextSibling.type !== 'text') {
|
|
60
|
+
const { childNodes } = parentNode;
|
|
61
|
+
start = childNodes.indexOf(this) + 1;
|
|
62
|
+
end = childNodes.indexOf(nextSibling);
|
|
63
|
+
contents = childNodes.slice(start, end);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
if (type === 'list') {
|
|
67
|
+
while (this.previousSibling?.is('list')) {
|
|
68
|
+
this.setText(this.previousSibling.innerText + this.innerText);
|
|
69
|
+
this.previousSibling.removeInternal();
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < nDt; i++) {
|
|
72
|
+
const token = this.nextSibling;
|
|
73
|
+
this.setText(this.innerText + token.innerText);
|
|
74
|
+
token.removeInternal();
|
|
75
|
+
}
|
|
76
|
+
if (parentNode.is('list-range')) {
|
|
77
|
+
parentNode.previousSibling.setText(parentNode.previousSibling.innerText + this.innerText);
|
|
78
|
+
this.removeInternal();
|
|
79
|
+
return parentNode;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const { childNodes } = parentNode;
|
|
83
|
+
start = childNodes.indexOf(this) + 1;
|
|
84
|
+
if (nextSibling) {
|
|
85
|
+
const { data } = nextSibling, offset = data.indexOf('\n'), text = new text_1.AstText(data.slice(0, offset));
|
|
86
|
+
end = childNodes.indexOf(nextSibling);
|
|
87
|
+
contents = childNodes.slice(start, end);
|
|
88
|
+
const last = contents.at(-1);
|
|
89
|
+
if (last) {
|
|
90
|
+
last.setAttribute('nextSibling', text);
|
|
91
|
+
text.setAttribute('previousSibling', last);
|
|
92
|
+
}
|
|
93
|
+
contents.push(text);
|
|
94
|
+
nextSibling.setAttribute('data', data.slice(offset));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
end = childNodes.length;
|
|
98
|
+
contents = childNodes.slice(start);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const token = debug_1.Shadow.run(() => {
|
|
102
|
+
const t = new index_1.Token(undefined, this.getAttribute('config'));
|
|
103
|
+
t.type = 'list-range';
|
|
104
|
+
return t;
|
|
105
|
+
});
|
|
106
|
+
token.concat(contents); // eslint-disable-line unicorn/no-unused-builtin-method-return
|
|
107
|
+
(0, debug_1.setChildNodes)(parentNode, start, end - start, [token]);
|
|
108
|
+
return token;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
7
111
|
}
|
|
8
112
|
exports.ListBaseToken = ListBaseToken;
|
package/dist/src/paramLine.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { ParamTagToken, FuncTagToken } from '../internal';
|
|
|
6
6
|
* parameter of certain extension tags
|
|
7
7
|
*
|
|
8
8
|
* 某些扩展标签的参数
|
|
9
|
-
* @classdesc `{childNodes: [AtomToken
|
|
9
|
+
* @classdesc `{childNodes: [AtomToken, AtomToken?]}`
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class ParamLineToken extends Token {
|
|
12
12
|
readonly name: string;
|
package/dist/src/paramLine.js
CHANGED
|
@@ -49,7 +49,7 @@ const skipTypes = new Set(['comment', 'include', 'noinclude']);
|
|
|
49
49
|
* parameter of certain extension tags
|
|
50
50
|
*
|
|
51
51
|
* 某些扩展标签的参数
|
|
52
|
-
* @classdesc `{childNodes: [AtomToken
|
|
52
|
+
* @classdesc `{childNodes: [AtomToken, AtomToken?]}`
|
|
53
53
|
*/
|
|
54
54
|
let ParamLineToken = (() => {
|
|
55
55
|
let _classDecorators = [(0, gapped_1.gapped)()];
|
package/dist/src/pre.d.ts
CHANGED
|
@@ -2,15 +2,16 @@ import { Token } from './index';
|
|
|
2
2
|
import { NoincludeToken } from './nowiki/noinclude';
|
|
3
3
|
import type { Config, LintError } from '../base';
|
|
4
4
|
import type { AstText, AttributesToken, ExtToken, ConverterToken } from '../internal';
|
|
5
|
+
declare type Child = NoincludeToken | ConverterToken;
|
|
5
6
|
/**
|
|
6
7
|
* `<pre>`
|
|
7
8
|
* @classdesc `{childNodes: (AstText|NoincludeToken|ConverterToken)[]}`
|
|
8
9
|
*/
|
|
9
10
|
export declare abstract class PreToken extends Token {
|
|
10
11
|
readonly name: 'pre';
|
|
11
|
-
readonly childNodes: readonly (
|
|
12
|
-
abstract get firstChild():
|
|
13
|
-
abstract get lastChild():
|
|
12
|
+
readonly childNodes: readonly (Child | AstText)[];
|
|
13
|
+
abstract get firstChild(): Child | AstText | undefined;
|
|
14
|
+
abstract get lastChild(): Child | AstText | undefined;
|
|
14
15
|
abstract get nextSibling(): undefined;
|
|
15
16
|
abstract get previousSibling(): AttributesToken | undefined;
|
|
16
17
|
abstract get parentNode(): ExtToken | undefined;
|
|
@@ -18,3 +19,4 @@ export declare abstract class PreToken extends Token {
|
|
|
18
19
|
/** @class */
|
|
19
20
|
constructor(wikitext?: string, config?: Config, accum?: Token[]);
|
|
20
21
|
}
|
|
22
|
+
export {};
|
package/dist/src/redirect.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { Config, LintError } from '../base';
|
|
|
6
6
|
* redirect
|
|
7
7
|
*
|
|
8
8
|
* 重定向
|
|
9
|
-
* @classdesc `{childNodes: [SyntaxToken,
|
|
9
|
+
* @classdesc `{childNodes: [SyntaxToken, RedirectTargetToken]}`
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class RedirectToken extends Token {
|
|
12
12
|
#private;
|
package/dist/src/redirect.js
CHANGED
|
@@ -44,7 +44,7 @@ const redirectTarget_1 = require("./link/redirectTarget");
|
|
|
44
44
|
* redirect
|
|
45
45
|
*
|
|
46
46
|
* 重定向
|
|
47
|
-
* @classdesc `{childNodes: [SyntaxToken,
|
|
47
|
+
* @classdesc `{childNodes: [SyntaxToken, RedirectTargetToken]}`
|
|
48
48
|
*/
|
|
49
49
|
let RedirectToken = (() => {
|
|
50
50
|
let _classDecorators = [(0, hidden_1.hiddenToken)(false, false), noEscape_1.noEscape];
|
|
@@ -6,7 +6,7 @@ import type { Token, CharinsertToken, AstText } from '../../internal';
|
|
|
6
6
|
* lines in `<charinsert>`
|
|
7
7
|
*
|
|
8
8
|
* `<charinsert>` 的行
|
|
9
|
-
* @classdesc `{childNodes: (AstText
|
|
9
|
+
* @classdesc `{childNodes: (AstText|ExtToken)[]}`
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class CharinsertLineToken extends SingleLineToken {
|
|
12
12
|
readonly childNodes: readonly (AstText | ExtToken)[];
|
|
@@ -13,7 +13,7 @@ const ext_1 = require("../tagPair/ext");
|
|
|
13
13
|
* lines in `<charinsert>`
|
|
14
14
|
*
|
|
15
15
|
* `<charinsert>` 的行
|
|
16
|
-
* @classdesc `{childNodes: (AstText
|
|
16
|
+
* @classdesc `{childNodes: (AstText|ExtToken)[]}`
|
|
17
17
|
*/
|
|
18
18
|
class CharinsertLineToken extends index_2.SingleLineToken {
|
|
19
19
|
get type() {
|
|
@@ -6,13 +6,13 @@ import type { TableCoords } from './trBase';
|
|
|
6
6
|
export type TableTokens = TableToken | TrToken | TdToken;
|
|
7
7
|
/** @extends {Array<TableCoords[]>} */
|
|
8
8
|
export declare class Layout extends Array<TableCoords[]> {
|
|
9
|
-
|
|
9
|
+
static from: (arr: TableCoords[][]) => Layout;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* table
|
|
13
13
|
*
|
|
14
14
|
* 表格
|
|
15
|
-
* @classdesc `{childNodes: [SyntaxToken, AttributesToken,
|
|
15
|
+
* @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...TdToken[], ...TrToken[], SyntaxToken?]}`
|
|
16
16
|
*/
|
|
17
17
|
export declare abstract class TableToken extends TrBaseToken {
|
|
18
18
|
readonly childNodes: readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[], SyntaxToken] | readonly [SyntaxToken, AttributesToken, ...(TdToken | TrToken)[]];
|
package/dist/src/table/index.js
CHANGED
|
@@ -53,7 +53,7 @@ exports.Layout = Layout;
|
|
|
53
53
|
* table
|
|
54
54
|
*
|
|
55
55
|
* 表格
|
|
56
|
-
* @classdesc `{childNodes: [SyntaxToken, AttributesToken,
|
|
56
|
+
* @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...TdToken[], ...TrToken[], SyntaxToken?]}`
|
|
57
57
|
*/
|
|
58
58
|
let TableToken = (() => {
|
|
59
59
|
let _classSuper = trBase_1.TrBaseToken;
|
package/dist/src/table/tr.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Token, TdToken, TableToken, SyntaxToken, AttributesToken } from '.
|
|
|
5
5
|
* table row that contains the newline at the beginning but not at the end
|
|
6
6
|
*
|
|
7
7
|
* 表格行,含开头的换行,不含结尾的换行
|
|
8
|
-
* @classdesc `{childNodes: [SyntaxToken, AttributesToken,
|
|
8
|
+
* @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...TdToken[]]}`
|
|
9
9
|
*/
|
|
10
10
|
export declare abstract class TrToken extends TrBaseToken {
|
|
11
11
|
readonly childNodes: readonly [SyntaxToken, AttributesToken, ...TdToken[]];
|
package/dist/src/table/tr.js
CHANGED
|
@@ -6,7 +6,7 @@ const trBase_1 = require("./trBase");
|
|
|
6
6
|
* table row that contains the newline at the beginning but not at the end
|
|
7
7
|
*
|
|
8
8
|
* 表格行,含开头的换行,不含结尾的换行
|
|
9
|
-
* @classdesc `{childNodes: [SyntaxToken, AttributesToken,
|
|
9
|
+
* @classdesc `{childNodes: [SyntaxToken, AttributesToken, ...TdToken[]]}`
|
|
10
10
|
*/
|
|
11
11
|
class TrToken extends trBase_1.TrBaseToken {
|
|
12
12
|
get type() {
|
package/dist/src/tag/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Token } from '../index';
|
|
2
2
|
import type { Config } from '../../base';
|
|
3
3
|
import type { AttributesToken, SyntaxToken } from '../../internal';
|
|
4
|
+
declare type Child = AttributesToken | SyntaxToken;
|
|
4
5
|
/**
|
|
5
6
|
* HTML tag
|
|
6
7
|
*
|
|
7
8
|
* HTML标签
|
|
8
|
-
* @classdesc `{childNodes: [AttributesToken]}`
|
|
9
|
+
* @classdesc `{childNodes: [AttributesToken|SyntaxToken]}`
|
|
9
10
|
*/
|
|
10
11
|
export declare abstract class TagToken extends Token {
|
|
11
12
|
#private;
|
|
12
|
-
readonly childNodes: readonly [
|
|
13
|
-
abstract get firstChild():
|
|
14
|
-
abstract get lastChild():
|
|
13
|
+
readonly childNodes: readonly [Child];
|
|
14
|
+
abstract get firstChild(): Child;
|
|
15
|
+
abstract get lastChild(): Child;
|
|
15
16
|
abstract get type(): 'html' | 'tvar';
|
|
16
17
|
abstract get selfClosing(): boolean | undefined;
|
|
17
18
|
/** whether to be a closing tag / 是否是闭合标签 */
|
|
@@ -21,7 +22,7 @@ export declare abstract class TagToken extends Token {
|
|
|
21
22
|
* @param attr 标签属性
|
|
22
23
|
* @param closing 是否闭合
|
|
23
24
|
*/
|
|
24
|
-
constructor(tag: string, attr:
|
|
25
|
+
constructor(tag: string, attr: Child, closing: boolean, config?: Config, accum?: Token[]);
|
|
25
26
|
/**
|
|
26
27
|
* Find the matching tag
|
|
27
28
|
*
|
|
@@ -29,3 +30,4 @@ export declare abstract class TagToken extends Token {
|
|
|
29
30
|
*/
|
|
30
31
|
findMatchingTag(): this | undefined;
|
|
31
32
|
}
|
|
33
|
+
export {};
|
package/dist/src/tag/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const index_1 = require("../index");
|
|
|
8
8
|
* HTML tag
|
|
9
9
|
*
|
|
10
10
|
* HTML标签
|
|
11
|
-
* @classdesc `{childNodes: [AttributesToken]}`
|
|
11
|
+
* @classdesc `{childNodes: [AttributesToken|SyntaxToken]}`
|
|
12
12
|
*/
|
|
13
13
|
class TagToken extends index_1.Token {
|
|
14
14
|
#closing;
|
|
@@ -47,7 +47,6 @@ class TagToken extends index_1.Token {
|
|
|
47
47
|
findMatchingTag() {
|
|
48
48
|
LINT: return (0, lint_1.cache)(this.#match, () => {
|
|
49
49
|
const { type, name, closing, selfClosing, } = this;
|
|
50
|
-
// eslint-disable-next-line prefer-const
|
|
51
50
|
let { parentNode } = this, isVoid = false, isFlexible = false;
|
|
52
51
|
if (type === 'html') {
|
|
53
52
|
const [, flexibleTags, voidTags] = this.getAttribute('config').html;
|
|
@@ -63,9 +62,15 @@ class TagToken extends index_1.Token {
|
|
|
63
62
|
}
|
|
64
63
|
const { childNodes } = parentNode, i = childNodes.indexOf(this), siblings = closing ? childNodes.slice(0, i) : childNodes.slice(i + 1).reverse(), stack = [this], { rev } = debug_1.Shadow;
|
|
65
64
|
let cur = siblings.pop(), until;
|
|
66
|
-
while (cur) {
|
|
67
|
-
// eslint-disable-next-line no-empty, @typescript-eslint/no-unnecessary-condition
|
|
65
|
+
while (cur || parentNode.is('list-range') && parentNode.parentNode) {
|
|
68
66
|
if (!cur) {
|
|
67
|
+
const parent = parentNode.parentNode, ch = parent.childNodes, j = ch.indexOf(parentNode);
|
|
68
|
+
Array.prototype.push.apply(siblings, closing ? ch.slice(0, j) : ch.slice(j + 1).reverse());
|
|
69
|
+
parentNode = parent;
|
|
70
|
+
}
|
|
71
|
+
else if (cur.is('list-range')) {
|
|
72
|
+
const ch = cur.childNodes;
|
|
73
|
+
Array.prototype.push.apply(siblings, closing ? ch : [...ch].reverse());
|
|
69
74
|
}
|
|
70
75
|
else if (until) {
|
|
71
76
|
if (cur === until) {
|
package/dist/src/tagPair/ext.js
CHANGED
|
@@ -223,7 +223,7 @@ let ExtToken = (() => {
|
|
|
223
223
|
LINT: {
|
|
224
224
|
const refName = this.getAttr('name'), text = this.innerText?.trim();
|
|
225
225
|
let msg = '';
|
|
226
|
-
if (this.closest('ext#references')) {
|
|
226
|
+
if (this.closest('ext-inner#references')) {
|
|
227
227
|
if (!refName) {
|
|
228
228
|
msg = 'no-named-in-references';
|
|
229
229
|
}
|
package/dist/src/transclude.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const invalidTemplateMsg = "Invalid template name";
|
|
|
8
8
|
* template or magic word
|
|
9
9
|
*
|
|
10
10
|
* 模板或魔术字
|
|
11
|
-
* @classdesc `{childNodes: [AtomToken|SyntaxToken, ...
|
|
11
|
+
* @classdesc `{childNodes: [AtomToken|SyntaxToken, ...ParameterToken[]]}`
|
|
12
12
|
*/
|
|
13
13
|
export declare abstract class TranscludeToken extends Token {
|
|
14
14
|
#private;
|
package/dist/src/transclude.js
CHANGED
|
@@ -55,7 +55,7 @@ const sortArgs = /** @ignore */ ({ childNodes }, args) => [...args].sort((a, b)
|
|
|
55
55
|
* template or magic word
|
|
56
56
|
*
|
|
57
57
|
* 模板或魔术字
|
|
58
|
-
* @classdesc `{childNodes: [AtomToken|SyntaxToken, ...
|
|
58
|
+
* @classdesc `{childNodes: [AtomToken|SyntaxToken, ...ParameterToken[]]}`
|
|
59
59
|
*/
|
|
60
60
|
let TranscludeToken = (() => {
|
|
61
61
|
let _classDecorators = [noEscape_1.noEscape, (0, gapped_1.gapped)()];
|
package/dist/util/debug.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mixin = exports.emptyArray = exports.getMagicWordInfo = exports.setChildNodes = exports.isLink = exports.isRowEnd = exports.Shadow = void 0;
|
|
3
|
+
exports.mixin = exports.emptyArray = exports.getMagicWordInfo = exports.setChildNodes = exports.isLink = exports.isRowEnd = exports.isIsolated = exports.Shadow = void 0;
|
|
4
4
|
exports.isToken = isToken;
|
|
5
5
|
exports.Shadow = {
|
|
6
6
|
running: false,
|
|
@@ -37,6 +37,12 @@ exports.Shadow = {
|
|
|
37
37
|
function isToken(type) {
|
|
38
38
|
return (node) => node.type === type;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* 扩展节点是否提供独立解析环境
|
|
42
|
+
* @param name 扩展节点名称
|
|
43
|
+
*/
|
|
44
|
+
const isIsolated = (name) => name === 'poem' || name === 'indicator';
|
|
45
|
+
exports.isIsolated = isIsolated;
|
|
40
46
|
/**
|
|
41
47
|
* 是否是行尾
|
|
42
48
|
* @param token 节点
|
package/i18n/en.json
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"duplicate-ext-parameter": "duplicate parameter of <$1>",
|
|
18
18
|
"duplicate-id": "duplicate HTML id",
|
|
19
19
|
"duplicate-image-parameter": "duplicate image $1 parameter",
|
|
20
|
+
"duplicate-name": "duplicate name of <indicator>",
|
|
20
21
|
"duplicate-parameter": "duplicate template parameter",
|
|
21
22
|
"encode": null,
|
|
22
23
|
"escape": null,
|
package/i18n/zh-hans.json
CHANGED
package/i18n/zh-hant.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikilint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A Node.js linter for MediaWiki markup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
"@bhsd/stylelint-util": "^1.1.0",
|
|
104
104
|
"culori": "^4.0.2",
|
|
105
105
|
"entities": "^8.1.0",
|
|
106
|
-
"vscode-languageserver-types": "^3.18.
|
|
106
|
+
"vscode-languageserver-types": "^3.18.5"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@bhsd/code-standard": "^5.
|
|
109
|
+
"@bhsd/code-standard": "^5.1.0",
|
|
110
110
|
"@bhsd/nodejs": "^1.2.1",
|
|
111
111
|
"@bhsd/test-util": "^3.3.0",
|
|
112
112
|
"ajv": "^8.20.0",
|
|
@@ -114,16 +114,16 @@
|
|
|
114
114
|
"c8": "^12.0.0",
|
|
115
115
|
"diff2html-cli": "^5.2.15",
|
|
116
116
|
"esbuild": "^0.28.2",
|
|
117
|
-
"eslint": "^10.
|
|
117
|
+
"eslint": "^10.14.0",
|
|
118
118
|
"mathoid-texvcjs": "^0.6.0",
|
|
119
119
|
"stylelint": "^17.16.0",
|
|
120
120
|
"typescript": "^6.0.3",
|
|
121
121
|
"vscode-css-languageservice": "^6.3.10",
|
|
122
122
|
"vscode-html-languageservice": "^5.6.2",
|
|
123
123
|
"vscode-json-languageservice": "^5.7.2",
|
|
124
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
124
|
+
"vscode-languageserver-textdocument": "^1.0.16"
|
|
125
125
|
},
|
|
126
126
|
"engines": {
|
|
127
|
-
"node": "^
|
|
127
|
+
"node": "^22.13.0 || >=24.11.0"
|
|
128
128
|
}
|
|
129
129
|
}
|