mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Minor optimizations to some patterns in mediawiki mode
Note that this .match() method is not the one you think it is. This is StringStream.match() from the CodeMirror lib, not ES String.match(). Change-Id: Ief5048ff78bcd035482e7a68044e24592d28cb6c
This commit is contained in:
parent
58e17dc734
commit
7404a9f2a0
|
@ -606,12 +606,12 @@
|
|||
// @todo error message
|
||||
} else if ( stream.match( /^[^\s\u00a0{[\]<>~).,']*/ ) ) {
|
||||
if ( stream.peek() === '~' ) {
|
||||
if ( !stream.match( /^~{3,}/, false ) ) {
|
||||
if ( !stream.match( /^~~~+/, false ) ) {
|
||||
stream.match( /^~*/ );
|
||||
return makeLocalStyle( 'mw-free-extlink', state );
|
||||
}
|
||||
} else if ( stream.peek() === '{' ) {
|
||||
if ( !stream.match( /^\{\{/, false ) ) {
|
||||
if ( !stream.match( '{{', false ) ) {
|
||||
stream.next();
|
||||
return makeLocalStyle( 'mw-free-extlink', state );
|
||||
}
|
||||
|
@ -648,7 +648,7 @@
|
|||
ch = stream.next();
|
||||
switch ( ch ) {
|
||||
case '-':
|
||||
if ( stream.match( /^----*/ ) ) {
|
||||
if ( stream.match( /^---+/ ) ) {
|
||||
return 'mw-hr';
|
||||
}
|
||||
break;
|
||||
|
@ -663,19 +663,17 @@
|
|||
break;
|
||||
case '*':
|
||||
case '#':
|
||||
if ( stream.match( /^[*#]*:*/ ) ) {
|
||||
return 'mw-list';
|
||||
}
|
||||
break;
|
||||
// Just consume all nested list and indention syntax when there is more
|
||||
stream.match( /^[*#]*:*/ );
|
||||
return 'mw-list';
|
||||
case ':':
|
||||
if ( stream.match( /^:*{\|/, false ) ) { // Highlight indented tables :{|, bug T108454
|
||||
state.stack.push( state.tokenize );
|
||||
state.tokenize = eatStartTable;
|
||||
}
|
||||
if ( stream.match( /^:*[*#]*/ ) ) {
|
||||
return 'mw-indenting';
|
||||
}
|
||||
break;
|
||||
// Just consume all nested list and indention syntax when there is more
|
||||
stream.match( /^:*[*#]*/ );
|
||||
return 'mw-indenting';
|
||||
case ' ':
|
||||
if ( stream.match( /^[\s\u00a0]*:*{\|/, false ) ) { // Leading spaces is the correct syntax for a table, bug T108454
|
||||
stream.eatSpace();
|
||||
|
|
Loading…
Reference in a new issue