Improvements for template / -argument precedence; support for empty params

Change-Id: Id0894ccbedfa47fa3658817ca65119a2af76be3e
This commit is contained in:
Gabriel Wicke 2012-04-04 16:29:47 +02:00
parent 2037215185
commit e3a745a024
2 changed files with 8 additions and 4 deletions

View file

@ -300,7 +300,11 @@ MWParserEnvironment.prototype.sanitizeURI = function ( s ) {
MWParserEnvironment.prototype.dp = function ( ) {
if ( this.debug ) {
if ( arguments.length > 1 ) {
console.warn( JSON.stringify( arguments, null, 2 ) );
try {
console.warn( JSON.stringify( arguments, null, 2 ) );
} catch ( e ) {
console.warn( e );
}
} else {
console.warn( arguments[0] );
}

View file

@ -830,8 +830,8 @@ ipv6_address
tplarg_or_template
=
! '{{{{{{{' (
&'{{{{{{' tplarg
/ & '{{{{{' template
& ( '{{{{{{' (!'}}}' .)* '}}}}}}') tplarg
/ & ( '{{{{{' (!'}}}' .)* '}}}}}') template
/ tplarg
/ template
)
@ -840,7 +840,7 @@ template
= "{{" (newline / space)*
target:template_name
params:(( newline / space )* "|"
r:( &"|" { return new KV( '', '') } // empty argument
r:( (newline / space )* &"|" { return new KV( '', '') } // empty argument
/ p:template_param { return p }
) { return r }
)*