From: Tim Starling Date: Sun, 13 Jan 2008 06:40:14 +0000 (+0000) Subject: Fix handling for whitespace in template arguments. X-Git-Tag: 1.31.0-rc.0~50036 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=1d5990f6708c46eb46a65442ed0699ef75fb4f06;hp=7f6453944e7684185dcb37a6a966156df3c870a4;p=lhc%2Fweb%2Fwiklou.git Fix handling for whitespace in template arguments. --- diff --git a/includes/Parser.php b/includes/Parser.php index c5d98f6425..6642fd6543 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3008,12 +3008,11 @@ class Parser foreach ( $parts as $partIndex => $part ) { if ( isset( $piece['eqpos'][$partIndex] ) ) { $eqpos = $piece['eqpos'][$partIndex]; - list( $ws1, $argName, $ws2 ) = self::splitWhitespace( substr( $part, 0, $eqpos ) ); - list( $ws3, $argValue, $ws4 ) = self::splitWhitespace( substr( $part, $eqpos + 1 ) ); - $element .= "$ws1$argName$ws2=$ws3$argValue$ws4"; + $argName = substr( $part, 0, $eqpos ); + $argValue = substr( $part, $eqpos + 1 ); + $element .= "$argName=$argValue"; } else { - list( $ws1, $value, $ws2 ) = self::splitWhitespace( $part ); - $element .= "$ws1$value$ws2"; + $element .= "$part"; $argIndex++; } } @@ -3634,8 +3633,10 @@ class Parser $arg = trim( $argWithSpaces ); if ( isset( $frame->args[$arg] ) ) { + # Found template argument $text = $frame->parent->expand( $frame->args[$arg] ); } else if ( ( $this->ot['html'] || $this->ot['pre'] ) && $parts->length > 0 ) { + # No match in frame, use the supplied default $text = $frame->expand( $parts->item( 0 ) ); } if ( !$this->incrementIncludeSize( 'arg', strlen( $text ) ) ) { @@ -3643,6 +3644,7 @@ class Parser } if ( $text === false ) { + # No match anywhere $text = '{{{' . $frame->implode( '|', $argWithSpaces, $parts ) . '}}}'; } if ( $error !== false ) {