--- Parser.php 2005-10-17 18:02:09.000000000 +0200 +++ Parser.php 2005-10-18 05:42:53.000000000 +0200 @@ -1984,7 +1984,7 @@ $text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", array( &$this, 'argSubstitution' ), $text ); } # Template substitution - $regex = '/(\\n|{)?{{(['.$titleChars.']*)(\\|.*?|)}}/s'; + $regex = '/(\\n|{)?{{(['.$titleChars.']*)(\\|({?[^{])*({{(?4)*(?5)*}}(?4)*)*|)}}/s'; $text = preg_replace_callback( $regex, array( &$this, 'braceSubstitution' ), $text ); array_pop( $this->mArgStack ); @@ -2036,10 +2036,12 @@ # If any of the arguments contains a '[[' but no ']]', it needs to be # merged with the next arg because the '|' character between belongs # to the link syntax and not the template parameter syntax. + # The same goes for '{{' and '}}' for nested templates. $argc = count($args); for ( $i = 0; $i < $argc-1; $i++ ) { - if ( substr_count ( $args[$i], '[[' ) != substr_count ( $args[$i], ']]' ) ) { + if ( substr_count ( $args[$i], '[[' ) != substr_count ( $args[$i], ']]' ) + || substr_count ( $args[$i], '{{' ) != substr_count ( $args[$i], '}}' ) ) { $args[$i] .= '|'.$args[$i+1]; array_splice($args, $i+1, 1); $i--;