jknack/handlebars.java — pull request #140 by c089 (2013-03-20 10:45:58+00:00)
Title: include helper

See associated discussion on js implementation:
* https://github.com/wycats/handlebars.js/issues/182

And the pull request which I tried to port here:
* https://github.com/wycats/handlebars.js/pull/368

I think this is a very helpful feature for people sharing templates between .java and .js as it can be used to replace simple helper functions which otherwise would require two implementations (one in java and one in javascript).

Note that it currently only passes a simpler test than the original pull request, because accessing the parent context seems to require a change to the parser which I did not want to dive into before I know that this has a chance of actually going in. I'd be happy to implement it though if you point me to the right place to make the change :)

I also think that the merge method should be refactored to the Context class itself but wanted the change to be minimally invasive for now so people who need this can easily add it to their own code.