@bhsd/codemirror-mediawiki 2.31.0 → 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 +170 -24
- package/dist/codemirror.d.ts +72 -47
- package/dist/codemirror.js +169 -208
- package/dist/color.d.ts +1 -6
- package/dist/color.js +1 -8
- package/dist/config.js +4 -4
- package/dist/escape.js +2 -2
- package/dist/fold.d.ts +53 -6
- package/dist/fold.js +130 -133
- package/dist/indent.d.ts +5 -1
- package/dist/indent.js +2 -1
- package/dist/javascript.d.ts +1 -0
- package/dist/javascript.js +2 -4
- package/dist/keybindings.js +1 -0
- package/dist/linter.js +43 -8
- package/dist/lintsource.d.ts +14 -0
- package/dist/lintsource.js +159 -0
- package/dist/main.min.js +25 -24
- package/dist/matchBrackets.d.ts +1 -1
- package/dist/matchTag.js +2 -2
- package/dist/mw.min.js +30 -29
- package/dist/mwConfig.js +0 -3
- package/dist/statusBar.d.ts +1 -1
- package/dist/token.d.ts +1 -1
- package/dist/token.js +11 -16
- package/dist/vue.d.ts +3 -0
- package/dist/vue.js +14 -0
- package/dist/wiki.min.js +29 -28
- package/i18n/en.json +2 -3
- package/i18n/zh-hans.json +2 -3
- package/i18n/zh-hant.json +2 -3
- package/package.json +10 -7
package/dist/mwConfig.js
CHANGED
|
@@ -198,9 +198,6 @@ var getParserConfig2 = (minConfig, mwConfig) => {
|
|
|
198
198
|
nsid,
|
|
199
199
|
variants
|
|
200
200
|
};
|
|
201
|
-
if (location.hostname.endsWith(".moegirl.org.cn")) {
|
|
202
|
-
config.html[2].push("img");
|
|
203
|
-
}
|
|
204
201
|
const noCM = mw.loader.getState("ext.CodeMirror") === null;
|
|
205
202
|
for (const [key, val] of Object.entries(insensitive)) {
|
|
206
203
|
if (others.has(val) && val !== "msgnw") {
|
package/dist/statusBar.d.ts
CHANGED
package/dist/token.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ export declare class MediaWiki {
|
|
|
182
182
|
inGallery(section?: boolean): Tokenizer;
|
|
183
183
|
'text/gallery'(tags: string[]): StreamParser<State>;
|
|
184
184
|
javascript(): StreamParser<unknown>;
|
|
185
|
-
css(): StreamParser<unknown>;
|
|
186
185
|
json(): StreamParser<unknown>;
|
|
186
|
+
lua(): StreamParser<unknown>;
|
|
187
187
|
}
|
|
188
188
|
export {};
|
package/dist/token.js
CHANGED
|
@@ -41,8 +41,8 @@ import { Tag } from '@lezer/highlight';
|
|
|
41
41
|
import { getRegex } from '@bhsd/common';
|
|
42
42
|
import { decodeHTML } from '@bhsd/browser';
|
|
43
43
|
import { otherParserFunctions } from '@bhsd/cm-util';
|
|
44
|
-
import { css } from '@codemirror/legacy-modes/mode/css';
|
|
45
44
|
import { javascript, json } from '@codemirror/legacy-modes/mode/javascript';
|
|
45
|
+
import { lua } from '@codemirror/legacy-modes/mode/lua';
|
|
46
46
|
import { htmlTags, voidHtmlTags, selfClosingTags, tokenTable, tokens } from './config';
|
|
47
47
|
class MediaWikiData {
|
|
48
48
|
constructor(tags) {
|
|
@@ -1249,23 +1249,18 @@ let MediaWiki = (() => {
|
|
|
1249
1249
|
const advance = (stream, state, re) => {
|
|
1250
1250
|
const mt = stream.match(re);
|
|
1251
1251
|
if (isLang) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
state.extMode = css;
|
|
1259
|
-
break;
|
|
1260
|
-
case 'json':
|
|
1261
|
-
state.extMode = json;
|
|
1262
|
-
// no default
|
|
1252
|
+
let lang = mt[0].trim().toLowerCase();
|
|
1253
|
+
if (lang === 'js') {
|
|
1254
|
+
lang = 'javascript';
|
|
1255
|
+
}
|
|
1256
|
+
if (lang in this) {
|
|
1257
|
+
state.extMode = this[lang]();
|
|
1263
1258
|
}
|
|
1264
1259
|
}
|
|
1265
1260
|
return makeLocalStyle(tokens.extTagAttributeValue + (isPage ? ` ${tokens.pageName}` : ''), state);
|
|
1266
1261
|
};
|
|
1267
1262
|
return (stream, state) => {
|
|
1268
|
-
if (stream.match('/>')
|
|
1263
|
+
if (stream.match('/>')) {
|
|
1269
1264
|
state.extMode = false;
|
|
1270
1265
|
pop(state);
|
|
1271
1266
|
return makeLocalTagStyle('extTagBracket', state);
|
|
@@ -2000,12 +1995,12 @@ let MediaWiki = (() => {
|
|
|
2000
1995
|
javascript() {
|
|
2001
1996
|
return javascript;
|
|
2002
1997
|
}
|
|
2003
|
-
css() {
|
|
2004
|
-
return css;
|
|
2005
|
-
}
|
|
2006
1998
|
json() {
|
|
2007
1999
|
return json;
|
|
2008
2000
|
}
|
|
2001
|
+
lua() {
|
|
2002
|
+
return lua;
|
|
2003
|
+
}
|
|
2009
2004
|
};
|
|
2010
2005
|
})();
|
|
2011
2006
|
export { MediaWiki };
|
package/dist/vue.d.ts
ADDED
package/dist/vue.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { vue } from '@codemirror/lang-vue';
|
|
2
|
+
import { htmlLanguage, htmlCompletionSource } from '@codemirror/lang-html';
|
|
3
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
4
|
+
import { LanguageSupport } from '@codemirror/language';
|
|
5
|
+
import { jsCompletion } from './javascript';
|
|
6
|
+
import css from './css';
|
|
7
|
+
export default () => vue({
|
|
8
|
+
base: new LanguageSupport(htmlLanguage, [
|
|
9
|
+
htmlLanguage.data.of({ autocomplete: htmlCompletionSource }),
|
|
10
|
+
javascript().support,
|
|
11
|
+
jsCompletion,
|
|
12
|
+
css(undefined).support,
|
|
13
|
+
]),
|
|
14
|
+
});
|