@bhsd/codemirror-mediawiki 3.4.2 → 3.5.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/dist/static.d.ts CHANGED
@@ -4,6 +4,8 @@ export declare const tagModes: {
4
4
  onlyinclude: string;
5
5
  includeonly: string;
6
6
  noinclude: string;
7
+ translate: string;
8
+ tvar: string;
7
9
  pre: string;
8
10
  nowiki: string;
9
11
  indicator: string;
package/dist/static.js CHANGED
@@ -2,6 +2,8 @@ export const tagModes = {
2
2
  onlyinclude: 'mediawiki',
3
3
  includeonly: 'mediawiki',
4
4
  noinclude: 'mediawiki',
5
+ translate: 'mediawiki',
6
+ tvar: 'mediawiki',
5
7
  pre: 'text/pre',
6
8
  nowiki: 'text/nowiki',
7
9
  indicator: 'mediawiki',
package/dist/token.js CHANGED
@@ -906,7 +906,7 @@ let MediaWiki = (() => {
906
906
  else if (stream.match(re) || space) {
907
907
  return makeStyle(style, state);
908
908
  }
909
- else if (stream.match(/^<(?!(?:includeonly|noinclude)(?:\/?>|\s|$))[/a-z]/iu, false)
909
+ else if (stream.match(/^<(?!(?:includeonly|noinclude)(?:\/?>|\s|$)|tvar(?:\s|$))[/a-z]/iu, false)
910
910
  && !stream.match(/^<onlyinclude>/u, false)) {
911
911
  lt = stream.pos + 1;
912
912
  }
@@ -1259,6 +1259,10 @@ let MediaWiki = (() => {
1259
1259
  };
1260
1260
  return (stream, state) => {
1261
1261
  if (stream.match('/>')) {
1262
+ if (name === 'tvar') {
1263
+ stream.backUp(1);
1264
+ return makeLocalTagStyle('error', state);
1265
+ }
1262
1266
  state.extMode = false;
1263
1267
  pop(state);
1264
1268
  return makeLocalTagStyle('extTagBracket', state);
@@ -1267,7 +1271,10 @@ let MediaWiki = (() => {
1267
1271
  const { config: { tagModes } } = this;
1268
1272
  state.extName = name;
1269
1273
  state.extMode ||= name in tagModes && (tagModes[name]) in this
1270
- && this[tagModes[name]](state.data.tags.filter(tag => tag !== name));
1274
+ && this[tagModes[name]]([
1275
+ ...state.data.tags.filter(tag => tag !== name),
1276
+ ...name === 'translate' ? ['tvar'] : [],
1277
+ ]);
1271
1278
  if (state.extMode) {
1272
1279
  state.extState = state.extMode.startState(0);
1273
1280
  }
@@ -1531,7 +1538,9 @@ let MediaWiki = (() => {
1531
1538
  return makeLocalTagStyle('comment', state);
1532
1539
  }
1533
1540
  else if (stream.match(/^<\/?onlyinclude>/u)
1534
- || stream.match(/^<(?:(?:includeonly|noinclude)(?:\s[^>]*)?\/?>|\/(?:includeonly|noinclude)\s*>)/iu)) {
1541
+ || stream.match(/^<(?:(?:includeonly|noinclude)(?:\s[^>]*)?\/?>|\/(?:includeonly|noinclude)\s*>)/iu)
1542
+ || state.data.tags.includes('tvar')
1543
+ && stream.match(/^<(?:tvar\s[^>]*>|\/tvar\s*>)/iu)) {
1535
1544
  return makeLocalTagStyle('comment', state);
1536
1545
  }
1537
1546
  else if (stream.eat('|')) {