@bhsd/codemirror-mediawiki 3.5.0 → 3.5.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/codemirror.d.ts +1 -1
- package/dist/codemirror.js +15 -5
- package/dist/escape.js +3 -5
- package/dist/fold.js +8 -14
- package/dist/hover.js +2 -3
- package/dist/inlay.js +2 -4
- package/dist/lintsource.d.ts +6 -1
- package/dist/lintsource.js +4 -2
- package/dist/lua.js +4 -0
- package/dist/main.min.js +25 -25
- package/dist/mediawiki.d.ts +1 -1
- package/dist/mediawiki.js +4 -3
- package/dist/mw.min.js +29 -29
- package/dist/mwConfig.js +22 -4
- package/dist/ref.js +2 -2
- package/dist/static.js +3 -2
- package/dist/statusBar.js +11 -27
- package/dist/token.d.ts +1 -1
- package/dist/token.js +18 -13
- package/dist/wiki.min.js +28 -28
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +7 -10
package/dist/mwConfig.js
CHANGED
|
@@ -12,6 +12,14 @@ var compareVersion = (version, baseVersion) => {
|
|
|
12
12
|
|
|
13
13
|
// ../cm-util/dist/index.mjs
|
|
14
14
|
var otherParserFunctions = /* @__PURE__ */ new Set(["msg", "raw", "subst", "safesubst"]);
|
|
15
|
+
var isUnderscore = (s) => !/^_{2}.+_{2}$/u.test(s);
|
|
16
|
+
var cleanAliases = (aliases) => {
|
|
17
|
+
for (const key in aliases) {
|
|
18
|
+
if (/^[^##].*:$/u.test(key)) {
|
|
19
|
+
delete aliases[key];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
15
23
|
var getConfig = (magicWords, rule, flip) => {
|
|
16
24
|
const words = magicWords.filter(rule);
|
|
17
25
|
return Object.fromEntries(
|
|
@@ -32,10 +40,12 @@ var getParserConfig = (minConfig, mwConfig) => {
|
|
|
32
40
|
redirection
|
|
33
41
|
} = mwConfig, [insensitive, sensitive] = functionSynonyms, behaviorSwitch = doubleUnderscore.map(
|
|
34
42
|
(obj, i) => Object.entries(obj).map(([k, v]) => [
|
|
35
|
-
k.slice(2, -2),
|
|
43
|
+
isUnderscore(k) ? k.slice(2, -2) : k,
|
|
36
44
|
i && typeof v === "string" ? v.toUpperCase() : v
|
|
37
45
|
])
|
|
38
46
|
);
|
|
47
|
+
cleanAliases(insensitive);
|
|
48
|
+
cleanAliases(sensitive);
|
|
39
49
|
for (const [k, v] of Object.entries(insensitive)) {
|
|
40
50
|
if (k in sensitive) {
|
|
41
51
|
delete insensitive[k];
|
|
@@ -48,7 +58,9 @@ var getParserConfig = (minConfig, mwConfig) => {
|
|
|
48
58
|
ext: Object.keys(tags),
|
|
49
59
|
parserFunction: [{ ...insensitive }, { ...sensitive, "=": "=" }, [], []],
|
|
50
60
|
doubleUnderscore: [
|
|
51
|
-
...behaviorSwitch.map(
|
|
61
|
+
...behaviorSwitch.map(
|
|
62
|
+
(entries) => entries.filter(([k]) => isUnderscore(k)).map(([k]) => k)
|
|
63
|
+
),
|
|
52
64
|
...behaviorSwitch.map(Object.fromEntries)
|
|
53
65
|
],
|
|
54
66
|
protocol: urlProtocols.replace(/\|\\?\/\\?\/$|\\(?=[:/])/gu, ""),
|
|
@@ -87,8 +99,12 @@ var getStaticMwConfig = ({
|
|
|
87
99
|
tags: Object.fromEntries(ext.map((s) => [s, true])),
|
|
88
100
|
tagModes: modes,
|
|
89
101
|
doubleUnderscore: [
|
|
90
|
-
Object.fromEntries(
|
|
91
|
-
|
|
102
|
+
Object.fromEntries(
|
|
103
|
+
(d2 && d0.length === 0 ? Object.keys(d2) : d0).map((s) => [isUnderscore(s) ? `__${s}__` : s, true])
|
|
104
|
+
),
|
|
105
|
+
Object.fromEntries(
|
|
106
|
+
(d3 && d1.length === 0 ? Object.keys(d3) : d1).map((s) => [isUnderscore(s) ? `__${s}__` : s, true])
|
|
107
|
+
)
|
|
92
108
|
],
|
|
93
109
|
functionHooks: functionHook,
|
|
94
110
|
variableIDs: variable,
|
|
@@ -152,6 +168,7 @@ var getMwConfig = async (modes) => {
|
|
|
152
168
|
if (config && !isIPE) {
|
|
153
169
|
const { functionSynonyms: [insensitive] } = config;
|
|
154
170
|
if (!("subst" in insensitive)) {
|
|
171
|
+
cleanAliases(insensitive);
|
|
155
172
|
Object.assign(insensitive, getConfig(magicwords, ({ name }) => others.has(name)));
|
|
156
173
|
}
|
|
157
174
|
} else {
|
|
@@ -169,6 +186,7 @@ var getMwConfig = async (modes) => {
|
|
|
169
186
|
)
|
|
170
187
|
};
|
|
171
188
|
}
|
|
189
|
+
cleanAliases(config.functionSynonyms[1]);
|
|
172
190
|
Object.assign(config, {
|
|
173
191
|
...getKeywords(magicwords, true),
|
|
174
192
|
tagModes: modes,
|
package/dist/ref.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { hoverTooltip, EditorView } from '@codemirror/view';
|
|
2
2
|
import { ensureSyntaxTree } from '@codemirror/language';
|
|
3
3
|
import { getLSP } from '@bhsd/browser';
|
|
4
|
+
import elt from 'crelt';
|
|
4
5
|
import { getTag } from './matchTag';
|
|
5
6
|
import { tokens } from './config';
|
|
6
7
|
import { indexToPos, posToIndex } from './hover';
|
|
@@ -49,8 +50,7 @@ export default (cm) => [
|
|
|
49
50
|
end: to,
|
|
50
51
|
above: true,
|
|
51
52
|
create() {
|
|
52
|
-
const dom =
|
|
53
|
-
dom.className = 'cm-tooltip-ref';
|
|
53
|
+
const dom = elt('div', { class: 'cm-tooltip-ref' });
|
|
54
54
|
dom.style.font = getComputedStyle(view.contentDOM).font;
|
|
55
55
|
if (ref) {
|
|
56
56
|
const { range: { start, end } } = ref[0], anchor = posToIndex(doc, start), head = posToIndex(doc, end);
|
package/dist/static.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isUnderscore } from '@bhsd/cm-util';
|
|
1
2
|
export const tagModes = {
|
|
2
3
|
onlyinclude: 'mediawiki',
|
|
3
4
|
includeonly: 'mediawiki',
|
|
@@ -24,8 +25,8 @@ export const getStaticMwConfig = ({ variable, parserFunction: [p0, p1, ...p2], p
|
|
|
24
25
|
tags: Object.fromEntries(ext.map(s => [s, true])),
|
|
25
26
|
tagModes: modes,
|
|
26
27
|
doubleUnderscore: [
|
|
27
|
-
Object.fromEntries((d2 && d0.length === 0 ? Object.keys(d2) : d0).map(s => [`__${s}__
|
|
28
|
-
Object.fromEntries((d3 && d1.length === 0 ? Object.keys(d3) : d1).map(s => [`__${s}__
|
|
28
|
+
Object.fromEntries((d2 && d0.length === 0 ? Object.keys(d2) : d0).map(s => [isUnderscore(s) ? `__${s}__` : s, true])),
|
|
29
|
+
Object.fromEntries((d3 && d1.length === 0 ? Object.keys(d3) : d1).map(s => [isUnderscore(s) ? `__${s}__` : s, true])),
|
|
29
30
|
],
|
|
30
31
|
functionHooks: functionHook,
|
|
31
32
|
variableIDs: variable,
|
package/dist/statusBar.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { showPanel, EditorView } from '@codemirror/view';
|
|
2
2
|
import { nextDiagnostic, setDiagnosticsEffect } from '@codemirror/lint';
|
|
3
|
+
import elt from 'crelt';
|
|
3
4
|
import { menuRegistry } from './codemirror';
|
|
4
|
-
const optionAll =
|
|
5
|
-
const ele = document.createElement('div');
|
|
6
|
-
ele.textContent = 'Fix all auto-fixable problems';
|
|
7
|
-
return ele;
|
|
8
|
-
})();
|
|
5
|
+
const optionAll = elt('div', 'Fix all auto-fixable problems');
|
|
9
6
|
function getLintMarker(view, severity, menu) {
|
|
10
|
-
const marker =
|
|
11
|
-
marker.className = `cm-status-${severity}`;
|
|
7
|
+
const marker = elt('div', { class: `cm-status-${severity}` }), icon = elt('div');
|
|
12
8
|
if (severity === 'fix') {
|
|
13
9
|
icon.className = 'cm-status-fix-disabled';
|
|
14
10
|
marker.title = 'Fix all';
|
|
@@ -27,9 +23,7 @@ function getLintMarker(view, severity, menu) {
|
|
|
27
23
|
}
|
|
28
24
|
else {
|
|
29
25
|
icon.className = `cm-lint-marker-${severity}`;
|
|
30
|
-
|
|
31
|
-
count.textContent = '0';
|
|
32
|
-
marker.append(icon, count);
|
|
26
|
+
marker.append(icon, elt('div', '0'));
|
|
33
27
|
marker.addEventListener('click', () => {
|
|
34
28
|
if (marker.parentElement?.classList.contains('cm-status-worker-enabled')) {
|
|
35
29
|
nextDiagnostic(view);
|
|
@@ -57,10 +51,7 @@ const updateDiagnosticMessage = (cm, allDiagnostics, main, msg) => {
|
|
|
57
51
|
msg.textContent = diagnostic.message;
|
|
58
52
|
if (diagnostic.actions) {
|
|
59
53
|
msg.append(...diagnostic.actions.map(({ name, apply }) => {
|
|
60
|
-
const button =
|
|
61
|
-
button.type = 'button';
|
|
62
|
-
button.className = 'cm-diagnosticAction';
|
|
63
|
-
button.textContent = name;
|
|
54
|
+
const button = elt('button', { type: 'button', class: 'cm-diagnosticAction' }, name);
|
|
64
55
|
button.addEventListener('click', e => {
|
|
65
56
|
e.preventDefault();
|
|
66
57
|
apply(view, diagnostic.from, diagnostic.to);
|
|
@@ -81,8 +72,7 @@ const updateMenu = (cm, allDiagnostics, main, classList, menu, fixer) => {
|
|
|
81
72
|
}
|
|
82
73
|
toggleClass(classList, true);
|
|
83
74
|
const actions = actionable.flatMap(({ getItems }) => getItems(cm)), quickfix = [...fixable].map(rule => {
|
|
84
|
-
const option =
|
|
85
|
-
option.textContent = `Fix all ${rule} problems`;
|
|
75
|
+
const option = elt('div', `Fix all ${rule} problems`);
|
|
86
76
|
option.dataset['rule'] = rule;
|
|
87
77
|
return option;
|
|
88
78
|
});
|
|
@@ -98,9 +88,7 @@ export default (cm, fixer) => [
|
|
|
98
88
|
showPanel.of(view => {
|
|
99
89
|
let diagnostics = [], menu;
|
|
100
90
|
if (!view.state.readOnly && (fixer || menuRegistry.length > 0)) {
|
|
101
|
-
menu =
|
|
102
|
-
menu.className = 'cm-status-fix-menu';
|
|
103
|
-
menu.tabIndex = -1;
|
|
91
|
+
menu = elt('div', { class: 'cm-status-fix-menu', tabIndex: -1 });
|
|
104
92
|
if (fixer) {
|
|
105
93
|
menu.addEventListener('click', ({ target }) => {
|
|
106
94
|
if (target === menu) {
|
|
@@ -122,14 +110,7 @@ export default (cm, fixer) => [
|
|
|
122
110
|
});
|
|
123
111
|
view.dom.append(menu);
|
|
124
112
|
}
|
|
125
|
-
const
|
|
126
|
-
worker.className = 'cm-status-worker';
|
|
127
|
-
worker.append(error, warning, fix);
|
|
128
|
-
message.className = 'cm-status-message';
|
|
129
|
-
position.className = 'cm-status-line';
|
|
130
|
-
position.textContent = '0:0';
|
|
131
|
-
dom.className = 'cm-panel cm-panel-status';
|
|
132
|
-
dom.append(worker, message, position);
|
|
113
|
+
const error = getLintMarker(view, 'error'), warning = getLintMarker(view, 'warning'), fix = getLintMarker(view, 'fix', menu), worker = elt('div', { class: 'cm-status-worker' }, error, warning, fix), message = elt('div', { class: 'cm-status-message' }), position = elt('div', { class: 'cm-status-line' }, '0:0'), dom = elt('div', { class: 'cm-panel cm-panel-status' }, worker, message, position), { classList } = fix.firstChild;
|
|
133
114
|
return {
|
|
134
115
|
dom,
|
|
135
116
|
update({ state: { selection: { main }, doc }, transactions, docChanged, selectionSet }) {
|
|
@@ -236,5 +217,8 @@ export default (cm, fixer) => [
|
|
|
236
217
|
'.cm-status-line': {
|
|
237
218
|
whiteSpace: 'nowrap',
|
|
238
219
|
},
|
|
220
|
+
'.cm-diagnosticText-clickable': {
|
|
221
|
+
cursor: 'pointer',
|
|
222
|
+
},
|
|
239
223
|
}),
|
|
240
224
|
];
|
package/dist/token.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ export declare class MediaWiki {
|
|
|
138
138
|
inLinkText(file: boolean, gallery?: boolean): Tokenizer;
|
|
139
139
|
toEatImageParameter(stream: StringStream, state: State): void;
|
|
140
140
|
eatList(stream: StringStream, state: State): string;
|
|
141
|
-
eatDoubleUnderscore(style: string, stream: StringStream, state: State): Style;
|
|
141
|
+
eatDoubleUnderscore(style: string, ch: '_' | '_', stream: StringStream, state: State): Style;
|
|
142
142
|
get eatStartTable(): Tokenizer<string>;
|
|
143
143
|
inTableDefinition(tr?: boolean, quote?: string): Tokenizer;
|
|
144
144
|
get inTable(): Tokenizer;
|
package/dist/token.js
CHANGED
|
@@ -170,6 +170,7 @@ const lookahead = (chars, comment) => {
|
|
|
170
170
|
'<': comment ? '<(?!!--)' : '<(?!!--|/?[a-z])',
|
|
171
171
|
'~': '~~?(?!~)',
|
|
172
172
|
_: '_(?!_)',
|
|
173
|
+
'_': '_(?!_)',
|
|
173
174
|
'[': String.raw `\[(?!\[)`,
|
|
174
175
|
']': String.raw `\](?!\])`,
|
|
175
176
|
'/': '/(?!>)',
|
|
@@ -329,7 +330,7 @@ const syntaxHighlight = new Set(['syntaxhighlight', 'source', 'pre']), pageFunct
|
|
|
329
330
|
'canonicalurle',
|
|
330
331
|
'int',
|
|
331
332
|
'msgnw',
|
|
332
|
-
]), substs = new Set(['subst', 'safesubst']), headerRegex = new RegExp(`^(?:[^&[<{~'-]|${lookahead("<{~'-")})+`, 'iu'), templateRegex = new RegExp(`^(?:[^|{}<]|${lookahead('{}<', true)})+`, 'u'), argumentRegex = new RegExp(`^(?:[^|[&:}{<~'_
|
|
333
|
+
]), substs = new Set(['subst', 'safesubst']), headerRegex = new RegExp(`^(?:[^&[<{~'-]|${lookahead("<{~'-")})+`, 'iu'), templateRegex = new RegExp(`^(?:[^|{}<]|${lookahead('{}<', true)})+`, 'u'), argumentRegex = new RegExp(`^(?:[^|[&:}{<~'__-]|${lookahead("}{<~'__-")})+`, 'iu'), styleRegex = new RegExp(`^(?:[^|[&}{<~'__-]|${lookahead("}{<~'__-")})+`, 'iu'), wikiRegex = new RegExp(`^(?:[^&'{[<~__:-]|${lookahead("'{[<~__-")})+`, 'iu'), tableDefinitionRegex = new RegExp(`^(?:[^&={<]|${lookahead('{<')})+`, 'iu'), tableCellRegex = /^\s*(?:[|!]|\{\{\s*![!)+-]?\s*\}\})/u, extLinkChars = "[{'<-", tableDefinitionChars = '{<', tableCellChars = "'<~__{-", htmlAttrChars = '{/', freeRegex = [false, true].map(lpar => {
|
|
333
334
|
const punctuations = getPunctuations(lpar), source = getUrlRegex(punctuations);
|
|
334
335
|
return new RegExp(`^(?:${source}|[${punctuations}]+(?=${source}))*`, 'u');
|
|
335
336
|
}), indentedTableRegex = [false, true].map(isTemplate => new RegExp(String.raw `^:*\s*(?=\{${getPipe(isTemplate)})`, 'u')), tableRegex = [false, true]
|
|
@@ -340,7 +341,10 @@ const syntaxHighlight = new Set(['syntaxhighlight', 'source', 'pre']), pageFunct
|
|
|
340
341
|
new RegExp(String.raw `^(?:[<>{}]|%(?:3[ce]|[57][bd])|${lookahead('[]')})+`, 'iu'),
|
|
341
342
|
new RegExp(String.raw `^(?:\}|${lookahead('[]{')})+`, 'u'),
|
|
342
343
|
new RegExp(String.raw `^(?:[>}]|%(?:3[ce]|[57][bd])|${lookahead('[]{<')})+`, 'iu'),
|
|
343
|
-
], tableDefinitionValueRegex = ['', '='].map(equal => new RegExp(String.raw `^(?:[^\s&${tableDefinitionChars}${equal}]|${lookahead(tableDefinitionChars)})+`, 'iu')), variableRegex = [false, true].map(isDefault => new RegExp(String.raw `^(?:[^|{}<${isDefault ? "[&~'_
|
|
344
|
+
], tableDefinitionValueRegex = ['', '='].map(equal => new RegExp(String.raw `^(?:[^\s&${tableDefinitionChars}${equal}]|${lookahead(tableDefinitionChars)})+`, 'iu')), variableRegex = [false, true].map(isDefault => new RegExp(String.raw `^(?:[^|{}<${isDefault ? "[&~'__:-" : ''}]|\}(?!\}\})|${isDefault ? lookahead("{<~'__-") : lookahead('{<', true)})+`, 'iu')), parserFunctionRegex = ['', '[&', '[&:'].map(s => getRegex(chars => new RegExp(`^(?:[^|${s}${chars}]|${lookahead(chars)})+`, 'iu'))), doubleUnderscoreRegex = {
|
|
345
|
+
_: /^[\p{L}\p{N}_]+?__/u,
|
|
346
|
+
'_': /^[\p{L}\p{N}__]+?_{2}/u,
|
|
347
|
+
}, getExtLinkTextRegex = getRegex(pipe => new RegExp(String.raw `^(?:[^\]&${pipe}${extLinkChars}]|${lookahead(extLinkChars)})+`, 'iu')), getExtLinkRegex = getRegex(pipe => new RegExp(`^(?:${getUrlRegex(pipe)})+`, 'u')), getTableDefinitionRegex = getRegex(s => new RegExp(`^(?:[^&${tableDefinitionChars}${s}]|${lookahead(tableDefinitionChars)})+`, 'iu')), getTableCellRegex = getRegex(s => new RegExp(`^(?:[^[&${s}${tableCellChars}]|${lookahead(tableCellChars)})+`, 'iu')), getHtmlAttrRegex = getRegex(s => new RegExp(`^(?:[^<>&${htmlAttrChars}${s}]|${lookahead(htmlAttrChars)})+`, 'u')), getHtmlAttrKeyRegex = getRegex(pipe => new RegExp(`^(?:[^<>&={/${pipe}]|${lookahead('{/')})+`, 'u')), getExtAttrRegex = getRegex(s => new RegExp(`^(?:[^>/${s}]|${lookahead('/')})+`, 'u')), getExtTagCloseRegex = getRegex(name => name === 'onlyinclude'
|
|
344
348
|
? /<\/onlyinclude(?:>|$)/u
|
|
345
349
|
: new RegExp(String.raw `</${name}\s*(?:>|$)`, 'iu')), getNestedRegex = getRegex(tag => new RegExp(String.raw `^(?:[^<]|<(?!${tag}(?:[\s/>]|$)))+`, 'iu'));
|
|
346
350
|
/** Adapted from the original CodeMirror 5 stream parser by Pavel Astakhov */
|
|
@@ -469,7 +473,7 @@ let MediaWiki = (() => {
|
|
|
469
473
|
this.imgRegex = new RegExp(String.raw `^(?:${this.img.filter(word => word.endsWith('$1')).map(word => word.slice(0, -2))
|
|
470
474
|
.join('|')}|(?:${this.img.filter(word => !word.endsWith('$1')).join('|')}|(?:\d+x?|\d*x\d+)\s*(?:px)?px)\s*(?=\||\]\]|$))`, 'u');
|
|
471
475
|
this.tags = [...Object.keys(tags), 'includeonly', 'noinclude', 'onlyinclude'];
|
|
472
|
-
this.convertRegex = new RegExp(String.raw `^(?:[^}|;&='{[<~_
|
|
476
|
+
this.convertRegex = new RegExp(String.raw `^(?:[^}|;&='{[<~__-]|\}(?!-)|=(?!>)|\[(?!\[|${urlProtocols})|${lookahead("'{<~__-")})+`, 'iu');
|
|
473
477
|
this.convertSemicolon = variants && new RegExp(String.raw `^;\s*(?=(?:[^;]*?=>\s*)?(?:${variants.join('|')})\s*:|(?:$|\}-))`, 'iu');
|
|
474
478
|
this.convertLang = variants
|
|
475
479
|
&& new RegExp(String.raw `^(?:=>\s*)?(?:${variants.join('|')})\s*:`, 'iu');
|
|
@@ -706,14 +710,15 @@ let MediaWiki = (() => {
|
|
|
706
710
|
}
|
|
707
711
|
break;
|
|
708
712
|
}
|
|
709
|
-
case '_':
|
|
713
|
+
case '_':
|
|
714
|
+
case '_': {
|
|
710
715
|
const { pos } = stream;
|
|
711
|
-
stream.eatWhile(
|
|
716
|
+
stream.eatWhile(ch);
|
|
712
717
|
switch (stream.pos - pos) {
|
|
713
718
|
case 0:
|
|
714
719
|
break;
|
|
715
720
|
case 1:
|
|
716
|
-
return this.eatDoubleUnderscore(style, stream, state);
|
|
721
|
+
return this.eatDoubleUnderscore(style, ch, stream, state);
|
|
717
722
|
default:
|
|
718
723
|
if (!stream.eol()) {
|
|
719
724
|
stream.backUp(2);
|
|
@@ -768,13 +773,13 @@ let MediaWiki = (() => {
|
|
|
768
773
|
// no default
|
|
769
774
|
}
|
|
770
775
|
if (state.stack.length === 0) {
|
|
771
|
-
if (ch !== '_') {
|
|
776
|
+
if (ch !== '_' && ch !== '_') {
|
|
772
777
|
// highlight free external links, bug T108448
|
|
773
778
|
if (/[\p{L}\p{N}]/u.test(ch)) {
|
|
774
779
|
stream.backUp(1);
|
|
775
780
|
}
|
|
776
781
|
else {
|
|
777
|
-
stream.eatWhile(/[^\p{L}\p{N}_
|
|
782
|
+
stream.eatWhile(/[^\p{L}\p{N}__&'{[<~:-]/u);
|
|
778
783
|
}
|
|
779
784
|
const mt = stream.match(this.urlProtocols, false);
|
|
780
785
|
if (mt) {
|
|
@@ -978,11 +983,11 @@ let MediaWiki = (() => {
|
|
|
978
983
|
}
|
|
979
984
|
return makeLocalTagStyle('list', state);
|
|
980
985
|
}
|
|
981
|
-
eatDoubleUnderscore(style, stream, state) {
|
|
982
|
-
const { config: { doubleUnderscore } } = this, name = stream.match(
|
|
986
|
+
eatDoubleUnderscore(style, ch, stream, state) {
|
|
987
|
+
const { config: { doubleUnderscore } } = this, underscore = ch.repeat(2), name = stream.match(doubleUnderscoreRegex[ch]);
|
|
983
988
|
if (name) {
|
|
984
|
-
if (Object.prototype.hasOwnProperty.call(doubleUnderscore[0],
|
|
985
|
-
|| Object.prototype.hasOwnProperty.call(doubleUnderscore[1],
|
|
989
|
+
if (Object.prototype.hasOwnProperty.call(doubleUnderscore[0], underscore + name[0].toLowerCase())
|
|
990
|
+
|| Object.prototype.hasOwnProperty.call(doubleUnderscore[1], underscore + name[0])) {
|
|
986
991
|
return tokens.doubleUnderscore;
|
|
987
992
|
}
|
|
988
993
|
else if (!stream.eol()) {
|
|
@@ -1583,7 +1588,7 @@ let MediaWiki = (() => {
|
|
|
1583
1588
|
if (n === 0) {
|
|
1584
1589
|
return this.inTemplateArgument(true, true);
|
|
1585
1590
|
}
|
|
1586
|
-
const chars = n === 2 ? '}{<' : "}{<~'_
|
|
1591
|
+
const chars = n === 2 ? '}{<' : "}{<~'__-"; // `#invoke`/`#tag`
|
|
1587
1592
|
let style = `${tokens.parserFunction} ${module ? tokens.pageName : ''}`;
|
|
1588
1593
|
switch (module) {
|
|
1589
1594
|
case 1:
|