From 067fd6c33e2031f52168cc5f03914e941d7f9830 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Tue, 3 Mar 2015 11:47:22 -0500 Subject: [PATCH 1/2] Failing Test For Inheritance Indentation inside a replacement variable. --- .../Test/Functional/InheritanceTest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Mustache/Test/Functional/InheritanceTest.php b/test/Mustache/Test/Functional/InheritanceTest.php index 730dd96..122ed31 100644 --- a/test/Mustache/Test/Functional/InheritanceTest.php +++ b/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' => '{{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( From 7cb9fdff6a6a86fa37403444705c508ec3de8f13 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 3 Mar 2015 10:05:27 -0800 Subject: [PATCH 2/2] Never indent block arg sections. Fixes #253 --- src/Mustache/Compiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index c872df4..860316f 100644 --- a/src/Mustache/Compiler.php +++ b/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; ';