mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Don't detect additional { as part of the template name
It's impossible to have a template that has the character { as part of the name. The real-world example explained in T292967 is the sequence {{{!}}. The old code detected this as: * A template that starts with {{ * The template name is {! * Template ends with }} New behavior as proposed in this patch: * A single { with no special meaning * The parser function {{!}} Note this is only a very small improvement, but doesn't fully solve T292967. Bug: T292967 Change-Id: Ica3fb110cebb5650f66be321b533ed030e2c9698
This commit is contained in:
parent
aa391c1c77
commit
4c92345e6f
|
@ -751,7 +751,7 @@
|
|||
state.stack.push( state.tokenize );
|
||||
state.tokenize = inVariable;
|
||||
return makeLocalStyle( 'mw-templatevariable-bracket', state );
|
||||
} else if ( stream.match( /^\{[\s\u00a0]*/ ) ) {
|
||||
} else if ( stream.match( /^{(?!{(?!{))[\s\u00a0]*/ ) ) {
|
||||
if ( stream.peek() === '#' ) { // Parser function
|
||||
state.nExt++;
|
||||
state.stack.push( state.tokenize );
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
{
|
||||
title: 'T292967: table syntax where all | are escaped with the {{!}} parser function',
|
||||
input: '{{{!}}\n{{!}}-\n{{!}}}',
|
||||
output: '<pre><span><span class="cm-mw-template-ground cm-mw-template-bracket">{{</span><span class="cm-mw-template-ground cm-mw-template-name cm-mw-pagename">{!</span><span class="cm-mw-template-ground cm-mw-template-bracket">}}</span></span></pre><pre><span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">{{</span><span class="cm-mw-ext-ground cm-mw-parserfunction-name">!</span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">}}</span>-</span></pre><pre><span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">{{</span><span class="cm-mw-ext-ground cm-mw-parserfunction-name">!</span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">}}</span>}</span></pre>'
|
||||
output: '<pre><span>{<span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">{{</span><span class="cm-mw-ext-ground cm-mw-parserfunction-name">!</span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">}}</span></span></pre><pre><span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">{{</span><span class="cm-mw-ext-ground cm-mw-parserfunction-name">!</span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">}}</span>-</span></pre><pre><span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">{{</span><span class="cm-mw-ext-ground cm-mw-parserfunction-name">!</span><span class="cm-mw-ext-ground cm-mw-parserfunction-bracket">}}</span>}</span></pre>'
|
||||
},
|
||||
{
|
||||
title: 'section headings',
|
||||
|
|
Loading…
Reference in a new issue