Skip to content

Commit

Permalink
Anchor dot notation context: {{ .foo }}
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Dec 27, 2014
1 parent f4f77a7 commit 066bcaa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Mustache/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ public function findDot($id)
{
$chunks = explode('.', $id);
$first = array_shift($chunks);
$value = $this->findVariableInStack($first, $this->stack);

if ($first === '') {
$value = $this->last();
} else {
$value = $this->findVariableInStack($first, $this->stack);
}

foreach ($chunks as $chunk) {
if ($value === '') {
Expand Down

0 comments on commit 066bcaa

Please sign in to comment.