Merge remote-tracking branch 'jazzdan/dev' into feature/template-inheritance

Conflicts:
	src/Mustache/Compiler.php
	test/Mustache/Test/TokenizerTest.php
This commit is contained in:
Justin Hileman
2014-06-26 21:51:03 -07:00
8 changed files with 747 additions and 13 deletions
+22
View File
@@ -15,6 +15,7 @@
class Mustache_Context
{
private $stack = array();
private $block_stack = array();
/**
* Mustache rendering Context constructor.
@@ -38,6 +39,11 @@ class Mustache_Context
array_push($this->stack, $value);
}
public function pushBlockContext($value)
{
array_push($this->block_stack, $value);
}
/**
* Pop the last Context frame from the stack.
*
@@ -48,6 +54,11 @@ class Mustache_Context
return array_pop($this->stack);
}
public function popBlockContext()
{
return array_pop($this->block_stack);
}
/**
* Get the last Context frame.
*
@@ -120,6 +131,17 @@ class Mustache_Context
return $value;
}
public function findInBlock($id)
{
foreach($this->block_stack as $context) {
if (array_key_exists($id, $context)) {
return $context[$id];
}
}
return '';
}
/**
* Helper function to find a variable in the Context stack.
*