fix highlighting template variable (v 1.9.2)

Change-Id: Iea975300c0ce1a3f80f75bff1be7b013bad4c420
This commit is contained in:
Pavel Astakhov 2014-09-02 10:53:00 +06:00
parent 89e584b947
commit 5cbe8bd28f
2 changed files with 3 additions and 8 deletions

View file

@ -15,7 +15,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is an extension to MediaWiki and thus not a valid entry point.' );
}
const EXT_CODEMIRROR_VERSION = '1.9.1';
const EXT_CODEMIRROR_VERSION = '1.9.2';
// Register this extension on Special:Version
$wgExtensionCredits['parserhook'][] = array(

View file

@ -143,19 +143,14 @@ CodeMirror.defineMode('mediawiki', function( config/*, parserConfig */ ) {
style.push( 'string' );
break;
case 'TemplateVariable':
if ( stream.eatWhile( /[^\}\&]/ ) ) {
if ( stream.eatWhile( /[^\}\[\]<\{\|\&]/ ) ) {
return 'variable-2';
}
if ( stream.match( '}}}' ) ) {
state.ImInBlock.pop();
return 'variable-2';
}
if ( stream.peek() === '&' ) {
style = ['variable-2'];
} else {
stream.next();
return 'variable-2';
}
style = ['variable-2'];
break;
case 'ParserFunctionName':
if ( stream.match( /#?[^\s\u00a0\}\[\]<\{\'\|\&\:]+/ ) ) { // FIXME: {{#name}} and and {{uc}} are wrong, must have ':'