@bhsd/codemirror-mediawiki 3.6.1 → 3.6.2
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/escape.js +0 -1
- package/dist/fold.js +1 -3
- package/dist/linter.d.ts +1 -1
- package/dist/linter.js +2 -3
- package/dist/lua.js +1 -7
- package/dist/main.min.js +24 -24
- package/dist/matchBrackets.js +2 -4
- package/dist/mediawiki.js +0 -2
- package/dist/mw.min.js +27 -27
- package/dist/statusBar.js +0 -1
- package/dist/token.js +16 -28
- package/dist/wiki.min.js +25 -25
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +24 -24
package/dist/statusBar.js
CHANGED
|
@@ -83,7 +83,6 @@ const updateMenu = (cm, allDiagnostics, main, classList, optionAll, menu, fixer)
|
|
|
83
83
|
menu.replaceChildren(...actions, ...quickfix);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
86
|
export default (cm, fixer) => [
|
|
88
87
|
showPanel.of(view => {
|
|
89
88
|
let diagnostics = [], menu;
|
package/dist/token.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author pastakhov, MusikAnimal, Bhsd and others
|
|
3
|
-
* @license GPL-2.0-or-later
|
|
4
|
-
* @see https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror
|
|
5
|
-
*/
|
|
6
1
|
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
7
2
|
var useValue = arguments.length > 2;
|
|
8
3
|
for (var i = 0; i < initializers.length; i++) {
|
|
@@ -37,6 +32,12 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
37
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
38
33
|
done = true;
|
|
39
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* @author pastakhov, MusikAnimal, Bhsd and others
|
|
37
|
+
* @license GPL-2.0-or-later
|
|
38
|
+
* @see https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror
|
|
39
|
+
*/
|
|
40
|
+
/* eslint-disable @typescript-eslint/class-methods-use-this */
|
|
40
41
|
import { Tag } from '@lezer/highlight';
|
|
41
42
|
import { getRegex } from '@bhsd/common';
|
|
42
43
|
import { decodeHTML } from '@bhsd/browser';
|
|
@@ -120,7 +121,7 @@ const copyState = (state) => {
|
|
|
120
121
|
}
|
|
121
122
|
else if (key !== 'data' && val && typeof val === 'object') {
|
|
122
123
|
// @ts-expect-error initial value
|
|
123
|
-
result[key] = { ...val };
|
|
124
|
+
result[key] = { ...val };
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
return result;
|
|
@@ -129,9 +130,7 @@ const copyState = (state) => {
|
|
|
129
130
|
* 判断字符串是否为 HTML 实体
|
|
130
131
|
* @param str 字符串
|
|
131
132
|
*/
|
|
132
|
-
const isHtmlEntity = (str) =>
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
134
|
-
typeof document !== 'object' || str.startsWith('#') || [...decodeHTML(`&${str}`)].length === 1;
|
|
133
|
+
const isHtmlEntity = (str) => typeof document !== 'object' || str.startsWith('#') || [...decodeHTML(`&${str}`)].length === 1;
|
|
135
134
|
/**
|
|
136
135
|
* 更新内部 Tokenizer
|
|
137
136
|
* @param state
|
|
@@ -180,7 +179,6 @@ const lookahead = (chars, comment) => {
|
|
|
180
179
|
const { data: { tags } } = comment;
|
|
181
180
|
table['<'] = String.raw `<(?!!--${tags.includes('onlyinclude') ? '|onlyinclude>' : ''}|(?:${tags.filter(tag => tag !== 'onlyinclude').join('|')})(?:[\s/>]|$))`;
|
|
182
181
|
}
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
184
182
|
return [...chars].map(ch => table[ch]).join('|');
|
|
185
183
|
};
|
|
186
184
|
/**
|
|
@@ -383,12 +381,8 @@ let MediaWiki = (() => {
|
|
|
383
381
|
return class MediaWiki {
|
|
384
382
|
static {
|
|
385
383
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
386
|
-
_inChars_decorators = [(getTokenizer)
|
|
387
|
-
|
|
388
|
-
];
|
|
389
|
-
_inStr_decorators = [(getTokenizer)
|
|
390
|
-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
391
|
-
];
|
|
384
|
+
_inChars_decorators = [(getTokenizer)];
|
|
385
|
+
_inStr_decorators = [(getTokenizer)];
|
|
392
386
|
_eatWikiText_decorators = [getTokenizer];
|
|
393
387
|
_eatApostrophes_decorators = [getTokenizer];
|
|
394
388
|
_eatExternalLinkProtocol_decorators = [(getTokenizer)];
|
|
@@ -405,9 +399,7 @@ let MediaWiki = (() => {
|
|
|
405
399
|
_inHtmlTagAttribute_decorators = [getTokenizer];
|
|
406
400
|
_inExtTagAttribute_decorators = [(getTokenizer)];
|
|
407
401
|
_eatExtTagArea_decorators = [(getTokenizer)];
|
|
408
|
-
_inExtTokens_decorators = [(getTokenizer)
|
|
409
|
-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
410
|
-
];
|
|
402
|
+
_inExtTokens_decorators = [(getTokenizer)];
|
|
411
403
|
_inVariable_decorators = [getTokenizer];
|
|
412
404
|
_inSubst_decorators = [(getTokenizer)];
|
|
413
405
|
_inParserFunctionName_decorators = [(getTokenizer)];
|
|
@@ -501,7 +493,6 @@ let MediaWiki = (() => {
|
|
|
501
493
|
* @param parent
|
|
502
494
|
*/
|
|
503
495
|
addToken(token, hidden = false, parent) {
|
|
504
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
505
496
|
this[hidden ? 'hiddenTable' : 'tokenTable'][`mw-${token}`] ??= Tag.define(parent);
|
|
506
497
|
}
|
|
507
498
|
/**
|
|
@@ -556,7 +547,7 @@ let MediaWiki = (() => {
|
|
|
556
547
|
for (const tag of this.permittedHtmlTags) {
|
|
557
548
|
this.addToken(`html-${tag}`, true);
|
|
558
549
|
}
|
|
559
|
-
for (const i
|
|
550
|
+
for (const i of Object.keys(this.autocompleteNamespaces)) {
|
|
560
551
|
if (Number.isInteger(Number(i))) {
|
|
561
552
|
this.addToken(`function-${i}`, true);
|
|
562
553
|
}
|
|
@@ -583,7 +574,7 @@ let MediaWiki = (() => {
|
|
|
583
574
|
}
|
|
584
575
|
eatWikiText(style) {
|
|
585
576
|
if (style in tokens) {
|
|
586
|
-
style = tokens[style];
|
|
577
|
+
style = tokens[style];
|
|
587
578
|
}
|
|
588
579
|
const regex = /^(?:(?:RFC|PMID)[\p{Zs}\t]+\d+|ISBN[\p{Zs}\t]+(?:97[89][\p{Zs}\t-]?)?(?:\d[\p{Zs}\t-]?){9}[\dxX])\b/u;
|
|
589
580
|
return (stream, state) => {
|
|
@@ -852,7 +843,6 @@ let MediaWiki = (() => {
|
|
|
852
843
|
return '';
|
|
853
844
|
};
|
|
854
845
|
}
|
|
855
|
-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
856
846
|
eatFreeExternalLink(stream, state) {
|
|
857
847
|
const mt = stream.match(freeRegex[0]);
|
|
858
848
|
if (!stream.eol() && mt[0].includes('(') && getPunctuations().includes(stream.peek())) {
|
|
@@ -974,7 +964,6 @@ let MediaWiki = (() => {
|
|
|
974
964
|
chain(state, this.inChars(mt[0], 'imageParameter'));
|
|
975
965
|
}
|
|
976
966
|
}
|
|
977
|
-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
978
967
|
eatList(stream, state) {
|
|
979
968
|
const mt = stream.match(/^[*#;:]*/u), { dt } = state;
|
|
980
969
|
if (mt[0].includes(';')) {
|
|
@@ -1165,8 +1154,8 @@ let MediaWiki = (() => {
|
|
|
1165
1154
|
if (dt.n && dt.html) {
|
|
1166
1155
|
dt.html--;
|
|
1167
1156
|
}
|
|
1168
|
-
if (tagname === inHtmlTag[
|
|
1169
|
-
inHtmlTag.
|
|
1157
|
+
if (tagname === inHtmlTag[inHtmlTag.length - 1]) {
|
|
1158
|
+
inHtmlTag.pop();
|
|
1170
1159
|
}
|
|
1171
1160
|
else {
|
|
1172
1161
|
chain(state, this.inStr('>', 'error'));
|
|
@@ -1207,7 +1196,7 @@ let MediaWiki = (() => {
|
|
|
1207
1196
|
const mt = stream.match(/^\/?>/u);
|
|
1208
1197
|
if (mt) {
|
|
1209
1198
|
if (!this.voidHtmlTags.has(name) && (mt[0] === '>' || !selfClosingTags.includes(name))) {
|
|
1210
|
-
state.inHtmlTag.
|
|
1199
|
+
state.inHtmlTag.push(name);
|
|
1211
1200
|
state.dt.html++;
|
|
1212
1201
|
}
|
|
1213
1202
|
pop(state);
|
|
@@ -1696,7 +1685,6 @@ let MediaWiki = (() => {
|
|
|
1696
1685
|
: this.eatWikiText(style)(stream, state);
|
|
1697
1686
|
};
|
|
1698
1687
|
}
|
|
1699
|
-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
1700
1688
|
eatEntity(stream, style) {
|
|
1701
1689
|
const entity = stream.match(/^(?:#x[a-f\d]+|#\d+|[a-z\d]+);/iu);
|
|
1702
1690
|
return entity && isHtmlEntity(entity[0]) ? tokens.htmlEntity : style;
|