Merge branch 'master' of git://github.com/XaminProject/handlebars.php

This commit is contained in:
behrooz shabani (everplays) 2012-10-29 15:43:06 +03:30
commit a5ef5f213b

View File

@ -110,11 +110,11 @@ class Handlebars_Template
$index++; $index++;
switch ($current[Handlebars_Tokenizer::TYPE]) { switch ($current[Handlebars_Tokenizer::TYPE]) {
case Handlebars_Tokenizer::T_SECTION : case Handlebars_Tokenizer::T_SECTION :
array_push($this->_stack, array(0, $current[Handlebars_Tokenizer::NODES])); $newStack = isset($current[Handlebars_Tokenizer::NODES]) ? $current[Handlebars_Tokenizer::NODES] : array();
array_push($this->_stack, array(0, $newStack));
$buffer .= $this->_section($context, $current); $buffer .= $this->_section($context, $current);
array_pop($this->_stack); array_pop($this->_stack);
break; break;
case Handlebars_Tokenizer::T_INVERTED : //TODO: This has no effect, remove the whole ^ thing!
case Handlebars_Tokenizer::T_COMMENT : case Handlebars_Tokenizer::T_COMMENT :
$buffer .= ''; $buffer .= '';
break; break;
@ -152,11 +152,15 @@ class Handlebars_Template
$helpers = $this->handlebars->getHelpers(); $helpers = $this->handlebars->getHelpers();
$sectionName = $current[Handlebars_Tokenizer::NAME]; $sectionName = $current[Handlebars_Tokenizer::NAME];
if ($helpers->has($sectionName)) { if ($helpers->has($sectionName)) {
$source = substr( if (isset($current[Handlebars_Tokenizer::END])) {
$this->getSource(), $source = substr(
$current[Handlebars_Tokenizer::INDEX], $this->getSource(),
$current[Handlebars_Tokenizer::END] - $current[Handlebars_Tokenizer::INDEX] $current[Handlebars_Tokenizer::INDEX],
); $current[Handlebars_Tokenizer::END] - $current[Handlebars_Tokenizer::INDEX]
);
} else {
$source = '';
}
$params = array( $params = array(
$this, //First argument is this template $this, //First argument is this template
$context, //Secound is current context $context, //Secound is current context