@bhsd/codemirror-mediawiki 2.31.0 → 3.0.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/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") {
@@ -1,4 +1,4 @@
1
1
  import type { Extension } from '@codemirror/state';
2
- import type { LintSource } from './codemirror';
2
+ import type { LintSource } from './lintsource';
3
3
  declare const _default: (fixer: LintSource["fixer"]) => Extension;
4
4
  export default _default;
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
- switch (mt[0].trim().toLowerCase()) {
1253
- case 'js':
1254
- case 'javascript':
1255
- state.extMode = javascript;
1256
- break;
1257
- case 'css':
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('/>') || name === 'img' && 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
@@ -0,0 +1,3 @@
1
+ import { LanguageSupport } from '@codemirror/language';
2
+ declare const _default: () => LanguageSupport;
3
+ export default _default;
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
+ });