wycats/handlebars.js — pull request #525 by williamcoates (2013-05-17 13:28:10+00:00)
Title: Add root context to data when using in-built #each and #which helpers

Sometimes you need to access variables from the root context in any other sub-context. It can be very painful having to always figure out the right path back to the root context when in multiple loops.

For example in my app i have an i18n object bound to the root context, that my i18n helper needs to access. If I can't easily access the root context i need to workaround this by backing up the context like so

```
{{#with ../..}} {{i18n 'Foo'}{{/with}}
```

This is painful, and not always possible if the above code is in a partial which might be used from different contexts.

This patch simply adds the root context to the data hash in the #each and #which helpers, so you can build helpers which access the root context like so:

```
function(string, options) {
return options.data.root.i18n.__(string);
}
```

It would be even cooler if you could do this in your templates:

```
{{@data.root.foo}}
```

But this would require altering the parser AFAIK which would require a bit more work...

Not sure on the etiquette for updating the distro, so I left those unchanged in this commit.