wycats/handlebars.js — pull request #256 by bensummers (2012-06-15 09:03:01+00:00)
Title: Changes for Mustache compatibility & latest version of therubyracer

Mustache compatibility
------------------------------

I'm in the process of changing a project to use Handlebars templates, and found a couple of differences between the way that Handlebars and Mustache work. Two of the commits in this pull request change Handlebars to be compatible with:

* Allow : in ID names, which allows partials with : to work. We use this for 'namespacing' partials.

* If there exists a property matching the name of the partial and the value is an object, move the context to that object

Getting going
-----------------

I also had problems getting the tests to run in the first place. There are two more commits to fix the developer documentation and add the this argument to procs as required by therubyracer.

Jison problem?
---------------------

There are three test failures which I couldn't fix, which look like this:

1) Parser raises if there's a Parse error
Failure/Error: lambda { ast_for("{{foo}") }.should raise_error(V8::JSError, /Parse error on line 1/)
expected V8::JSError with message matching /Parse error on line 1/, got #
# ./spec/parser_spec.rb:249

This may be a jison issue; it generates this code:

if (typeof action === "undefined" || !action.length || !action[0]) {
var errStr = "";
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}

which, if action === undefined, will then immediately evaluate action[0], which will throw this error.

I'm using jison 0.3.8.