Index: trunk/phase3/tests/phpunit/includes/parser/PreprocessorTest.php |
— | — | @@ -56,6 +56,7 @@ |
57 | 57 | array( "{{Foo|=bar}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name></name>=<value>bar</value></part></template></root>" ), |
58 | 58 | array( "{{Foo|bar=baz}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name>bar</name>=<value>baz</value></part></template></root>" ), |
59 | 59 | array( "{{Foo|1=bar|baz}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name>1</name>=<value>bar</value></part><part><name index=\"1\" /><value>baz</value></part></template></root>" ), |
| 60 | + array( "{{Foo|1=bar|2=baz}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name>1</name>=<value>bar</value></part><part><name>2</name>=<value>baz</value></part></template></root>" ), |
60 | 61 | array( "{{Foo|bar|foo=baz}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name index=\"1\" /><value>bar</value></part><part><name>foo</name>=<value>baz</value></part></template></root>" ), |
61 | 62 | array( "{{{1}}}", "<root><tplarg lineStart=\"1\"><title>1</title></tplarg></root>" ), |
62 | 63 | array( "{{{1|}}}", "<root><tplarg lineStart=\"1\"><title>1</title><part><name index=\"1\" /><value></value></part></tplarg></root>" ), |
— | — | @@ -96,6 +97,8 @@ |
97 | 98 | array( "{{foo|}", "<root>{{foo|}</root>"), |
98 | 99 | array( "{{foo|} }}", "<root><template lineStart=\"1\"><title>foo</title><part><name index=\"1\" /><value>} </value></part></template></root>"), |
99 | 100 | array( "{{foo|bar=|}", "<root>{{foo|bar=|}</root>"), |
| 101 | + array( "{{Foo|} Bar=", "<root>{{Foo|} Bar=</root>"), |
| 102 | + array( "{{Foo|} Bar=}}", "<root><template lineStart=\"1\"><title>Foo</title><part><name>} Bar</name>=<value></value></part></template></root>"), |
100 | 103 | /* array( file_get_contents( dirname( __FILE__ ) . '/QuoteQuran.txt' ), file_get_contents( dirname( __FILE__ ) . '/QuoteQuranExpanded.txt' ) ), */ |
101 | 104 | ); |
102 | 105 | } |
Index: trunk/extensions/NativePreprocessor/preprocesstoobj.c |
— | — | @@ -589,22 +589,18 @@ |
590 | 590 | } else if ( found == closeBrace || found == closeBracket ) { |
591 | 591 | // lets check if there are enough characters for closing brace |
592 | 592 | |
593 | | - if ( parentNode->type == name_node ) { |
594 | | - /* Go to close it */ |
595 | | - fakePipeFound = true; |
596 | | - continue; |
597 | | - } |
598 | 593 | assert( ( parentNode->type == found - 2 ) || |
599 | 594 | ( parentNode->parent && |
600 | | - ( ( parentNode->parent->type == found - 2 ) || ( parentNode->type == value_node && |
| 595 | + ( ( parentNode->parent->type == found - 2 ) || |
| 596 | + ( ( parentNode->type == value_node || parentNode->type == name_node ) && |
601 | 597 | parentNode->parent->parent && ( parentNode->parent->parent->type == found - 2 ) ) ) ) ); |
602 | 598 | |
603 | 599 | int maxCount; |
604 | 600 | if ( found == closeBracket ) { |
605 | 601 | maxCount = parentNode->count; |
606 | 602 | } else { |
607 | | - if ( parentNode->type == value_node ) { |
608 | | - /* template\part\value */ |
| 603 | + if ( parentNode->type == value_node || parentNode->type == name_node ) { |
| 604 | + /* template\part\value or template\part\name */ |
609 | 605 | maxCount = parentNode->parent->parent->count; |
610 | 606 | assert( parentNode->parent->parent->type == brace_node ); |
611 | 607 | } else { |
— | — | @@ -637,7 +633,7 @@ |
638 | 634 | matchingCount = count; |
639 | 635 | } |
640 | 636 | } |
641 | | - |
| 637 | + |
642 | 638 | if ( matchingCount <= 0 ) { |
643 | 639 | // No matching element found in callback array |
644 | 640 | // Output a literal closing brace and continue |
— | — | @@ -646,6 +642,13 @@ |
647 | 643 | i += count; |
648 | 644 | continue; |
649 | 645 | } |
| 646 | + |
| 647 | + if ( parentNode->type == name_node ) { |
| 648 | + /* Go to close it */ |
| 649 | + fakePipeFound = true; |
| 650 | + continue; |
| 651 | + } |
| 652 | + |
650 | 653 | if ( parentNode->type == value_node ) { |
651 | 654 | printf("%c in parent %c. Closing\n", found, parentNode->type); |
652 | 655 | closeNode( parentNode->type ); |