소스 검색

Merge branch 'fix/template-inheritance-whitespace' into dev

Justin Hileman 10 년 전
부모
커밋
c4b1712d98
2개의 변경된 파일24개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/Mustache/Compiler.php
  2. 23 0
      test/Mustache/Test/Functional/InheritanceTest.php

+ 1 - 1
src/Mustache/Compiler.php

@@ -263,7 +263,7 @@ class Mustache_Compiler
 
     const BLOCK_ARG = '
         // %s block_arg
-        $value = $this->section%s($context, $indent, true);
+        $value = $this->section%s($context, \'\', true);
         $newContext[%s] = %s$value;
     ';
 

+ 23 - 0
test/Mustache/Test/Functional/InheritanceTest.php

@@ -286,6 +286,29 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
         );
     }
 
+    public function testInheritSpacingWhenOverridingAPartial()
+    {
+        $partials = array(
+            'parent' => 'collaborate_and{{$id}}{{/id}}',
+            'child'  => '{{<parent}}{{$id}}_listen{{/id}}{{/parent}}',
+        );
+
+        $this->mustache->setPartials($partials);
+
+        $tpl = $this->mustache->loadTemplate(
+            'stop:
+              {{>child}}'
+        );
+
+        $data = array();
+
+        $this->assertEquals(
+            'stop:
+              collaborate_and_listen',
+            $tpl->render($data)
+        );
+    }
+
     public function testOverrideOneSubstitutionButNotTheOther()
     {
         $partials = array(