diff --git a/resources/mode/mediawiki/mediawiki.js b/resources/mode/mediawiki/mediawiki.js index a3723d7a..5f4d6add 100644 --- a/resources/mode/mediawiki/mediawiki.js +++ b/resources/mode/mediawiki/mediawiki.js @@ -744,7 +744,9 @@ } break; case '{': - if ( !stream.match( '{{{{', false ) && stream.match( '{{' ) ) { // Template parameter (skip parameters inside a template transclusion, Bug: T108450) + // Can't be a variable when it starts with more than 3 brackets (T108450) or + // a single { followed by a template. E.g. {{{!}} starts a table (T292967). + if ( stream.match( /^{{(?!{|[^{}]*}}(?!}))/ ) ) { stream.eatSpace(); state.stack.push( state.tokenize ); state.tokenize = inVariable; diff --git a/resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js b/resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js index ef630698..0964cc93 100644 --- a/resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js +++ b/resources/mode/mediawiki/tests/qunit/CodeMirror.mediawiki.test.js @@ -83,7 +83,7 @@ { title: 'T292967: table syntax where all | are escaped with the {{!}} parser function', input: '{{{!}}\n{{!}}-\n{{!}}}', - output: '
{{{!}}
{{!}}-
{{!}}}
' + output: '
{{{!}}
{{!}}-
{{!}}}
' }, { title: 'section headings',