wikilint 2.3.3 → 2.3.4
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/src/magicLink.js +1 -1
- package/dist/src/transclude.js +11 -3
- package/package.json +1 -1
package/dist/src/magicLink.js
CHANGED
|
@@ -29,7 +29,7 @@ class MagicLinkToken extends index_1.Token {
|
|
|
29
29
|
rect ??= { start, ...this.getRootNode().posFromIndex(start) };
|
|
30
30
|
const refError = (0, lint_1.generateForChild)(child, rect, '', 'warning');
|
|
31
31
|
errors.push(...[...data.matchAll(regexGlobal)].map(({ index, 0: s }) => {
|
|
32
|
-
const lines = data.slice(0, index).split('\n'), { length: top } = lines, { length: left } = lines.at(-1), startIndex =
|
|
32
|
+
const lines = data.slice(0, index).split('\n'), { length: top } = lines, { length: left } = lines.at(-1), startIndex = refError.startIndex + index, startLine = refError.startLine + top - 1, startCol = top === 1 ? refError.startCol + left : left;
|
|
33
33
|
return {
|
|
34
34
|
...refError,
|
|
35
35
|
message: Parser.msg('$1 in URL', s.startsWith('|') ? '"|"' : Parser.msg('full-width punctuation')),
|
package/dist/src/transclude.js
CHANGED
|
@@ -8,6 +8,14 @@ const index_1 = require("./index");
|
|
|
8
8
|
const parameter_1 = require("./parameter");
|
|
9
9
|
const atom_1 = require("./atom");
|
|
10
10
|
const syntax_1 = require("./syntax");
|
|
11
|
+
const insensitiveVars = new Set([
|
|
12
|
+
'pageid',
|
|
13
|
+
'articlepath',
|
|
14
|
+
'server',
|
|
15
|
+
'servername',
|
|
16
|
+
'scriptpath',
|
|
17
|
+
'stylepath',
|
|
18
|
+
]);
|
|
11
19
|
/**
|
|
12
20
|
* 模板或魔术字
|
|
13
21
|
* @classdesc `{childNodes: [AtomToken|SyntaxToken, ...AtomToken, ...ParameterToken]}`
|
|
@@ -37,9 +45,9 @@ class TranscludeToken extends index_1.Token {
|
|
|
37
45
|
}
|
|
38
46
|
const isFunction = title.includes(':');
|
|
39
47
|
if (isFunction || parts.length === 0 && !this.#raw) {
|
|
40
|
-
const [magicWord, ...arg] = title.split(':'), cleaned = (0, string_1.removeComment)(magicWord), name = cleaned[arg.length > 0 ? 'trimStart' : 'trim'](), isSensitive = sensitive.includes(name),
|
|
41
|
-
if (
|
|
42
|
-
this.setAttribute('name',
|
|
48
|
+
const [magicWord, ...arg] = title.split(':'), cleaned = (0, string_1.removeComment)(magicWord), name = cleaned[arg.length > 0 ? 'trimStart' : 'trim'](), lcName = name.toLowerCase(), canonicalName = insensitive[lcName], isSensitive = sensitive.includes(name), isVar = isSensitive || insensitiveVars.has(canonicalName);
|
|
49
|
+
if (isVar || isFunction && canonicalName) {
|
|
50
|
+
this.setAttribute('name', canonicalName ?? lcName);
|
|
43
51
|
this.type = 'magic-word';
|
|
44
52
|
const pattern = new RegExp(`^\\s*${name}\\s*$`, isSensitive ? 'u' : 'iu'), token = new syntax_1.SyntaxToken(magicWord, pattern, 'magic-word-name', config, accum, {});
|
|
45
53
|
super.insertAt(token);
|