Only pass indent through to standalone nested partials.

Fixes #214
This commit is contained in:
Justin Hileman
2014-08-07 10:45:33 -07:00
parent 5d77f4de9a
commit 35456764a1
+9 -2
View File
@@ -277,9 +277,10 @@ class Mustache_Compiler
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level));
}
const PARTIAL_INDENT = ', $indent . %s';
const PARTIAL = '
if ($partial = $this->mustache->loadPartial(%s)) {
$buffer .= $partial->renderInternal($context, $indent . %s);
$buffer .= $partial->renderInternal($context%s);
}
';
@@ -294,10 +295,16 @@ class Mustache_Compiler
*/
private function partial($id, $indent, $level)
{
if ($indent !== '') {
$indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
} else {
$indentParam = '';
}
return sprintf(
$this->prepare(self::PARTIAL, $level),
var_export($id, true),
var_export($indent, true)
$indentParam
);
}