janl/mustache.js — pull request #304 by danielfagerstrom (2013-03-17 18:52:26+00:00)
Title: Mustache specs - lambda compliance

Fixed most of the failing lambda tests from the Mustache spec from my Mustache spec [pull request](http://github.com/janl/mustache.js/pull/301).

The [spec](https://github.com/mustache/spec/blob/master/specs/~lambdas.yml) says that for a function that is returned in a section or an interpolation:

1. When used as the data value for an Interpolation tag, the lambda MUST be
treatable as an arity 0 function, and invoked as such. The returned value
MUST be rendered against the default delimiters, then interpolated in place
of the lambda.

2. When used as the data value for a Section tag, the lambda MUST be treatable
as an arity 1 function, and invoked as such (passing a String containing the
unprocessed section contents). The returned value MUST be rendered against
the current delimiters, then interpolated in place of the section.

In current mustache.js the return value from a function in a interpolation or section is not interpolated so I implemented that.

For the section functions this breaks one of the current tests so I updated that one.

The test for "Section - Alternate Delimiters - Lambdas used for sections should parse with the current delimiters." still fails, I couldn't find any reasonably simple way to fix that.