mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-13 17:27:42 +00:00
fix highlighting of external links, multiple apostrophes end link (3.1.14)
Change-Id: Ibbb4850edc04ed6b184fa59c51e1978d60cd1269
This commit is contained in:
parent
491f186e14
commit
66b518d8dd
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "CodeMirror",
|
||||
"version": "3.1.13",
|
||||
"version": "3.1.14",
|
||||
"author": [
|
||||
"[https://www.mediawiki.org/wiki/User:Pastakhov Pavel Astakhov]",
|
||||
"[https://www.mediawiki.org/wiki/User:Florianschmidtwelzow Florian Schmidt]"
|
||||
|
|
|
@ -268,7 +268,14 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
|
|||
state.tokenize = inExternalLinkText;
|
||||
return makeStyle( '', state );
|
||||
}
|
||||
if ( stream.match( /[^\s\u00a0\]\{\&~]+/ ) || stream.eatSpace() ) {
|
||||
if ( stream.match( /[^\s\u00a0\]\{\&~']+/ ) || stream.eatSpace() ) {
|
||||
if ( stream.peek() === '\'' ) {
|
||||
if ( stream.match( '\'\'', false ) ) {
|
||||
state.tokenize = inExternalLinkText;
|
||||
} else {
|
||||
stream.next();
|
||||
}
|
||||
}
|
||||
return makeStyle( 'mw-extlink', state );
|
||||
}
|
||||
return eatWikiText( 'mw-extlink', '' )( stream, state );
|
||||
|
@ -312,7 +319,7 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
|
|||
// if ( !stream.eatSpace() ) {
|
||||
// state.ImInBlock.push( 'LinkTrail' );
|
||||
// }
|
||||
}
|
||||
}
|
||||
if ( stream.match( /[\s\u00a0]*[^\s\u00a0#\|\]\&~\{]+/ ) || stream.eatSpace() ) { //FIXME '{{' brokes Link, sample [[z{{page]]
|
||||
return makeStyle( 'mw-link-pagename mw-pagename', state );
|
||||
}
|
||||
|
@ -390,7 +397,7 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
|
|||
state.tokenize = state.stack.pop();
|
||||
return makeLocalStyle( (isHtmlTag ? 'mw-htmltag-name' : 'mw-exttag-name'), state );
|
||||
}
|
||||
|
||||
|
||||
if ( isHtmlTag ) {
|
||||
if ( isCloseTag ) {
|
||||
state.tokenize = eatChar( '>', 'mw-htmltag-bracket' );
|
||||
|
@ -595,7 +602,7 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
|
|||
function eatFreeExternalLink( stream, state ) {
|
||||
if ( stream.eol() ) {
|
||||
// @todo error message
|
||||
} else if ( stream.match( /[^\s\u00a0\{\[\]<>~\)\.,]*/ ) ) {
|
||||
} else if ( stream.match( /[^\s\u00a0\{\[\]<>~\)\.,']*/ ) ) {
|
||||
if ( stream.peek() === '~' ) {
|
||||
if ( !stream.match( /~{3,}/, false ) ) {
|
||||
stream.match( /~*/ );
|
||||
|
@ -603,7 +610,12 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
|
|||
}
|
||||
} else if ( stream.peek() === '{' ) {
|
||||
if ( !stream.match( /\{\{/, false ) ) {
|
||||
stream.eat( '{' );
|
||||
stream.next();
|
||||
return makeLocalStyle( 'mw-free-extlink', state );
|
||||
}
|
||||
} else if ( stream.peek() === '\'' ) {
|
||||
if ( !stream.match( '\'\'', false ) ) {
|
||||
stream.next();
|
||||
return makeLocalStyle( 'mw-free-extlink', state );
|
||||
}
|
||||
} else if ( stream.match( /[\)\.,]+(?=[^\s\u00a0\{\[\]<>~\)\.,])/ ) ) {
|
||||
|
|
Loading…
Reference in a new issue