Skip to content

Commit

Permalink
Merge branch 'fix/template-inheritance-whitespace' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Apr 1, 2015
2 parents 7b57d9b + 7cb9fdf commit c4b1712
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mustache/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)

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

Expand Down
23 changes: 23 additions & 0 deletions test/Mustache/Test/Functional/InheritanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,29 @@ public function testInheritIndentationWhenOverridingAPartial()
);
}

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(
Expand Down

0 comments on commit c4b1712

Please sign in to comment.