5thWall/mustache-render — pull request #25 by corpulentcoffee (2014-10-19 16:26:38+00:00)
Title: Allow user-defined escape handling via a new 'escape' option

In response to issue #24 from @matyus and building on pull request #14 from @emanuelbsilva, this set of changes would do the following:

- introduce `options.escape`, which can be either
- `true` to observe the default escaping behavior suitable for HTML documents (**default**),
- `false` to disable escaping altogether, or
- a function with a signature like `function (text) { return text; }` to specify a custom escaping scheme
- wrap the `done()` Grunt callback to set `mustache.escape` back to the default `escapeHtml` function when the target finishes
- add unit tests for
- the default escaped output,
- unescaped output,
- user-defined custom escaping, and
- an additional test to verify `mustache.escape` is put back the way it was after a target finishes

If there are no objections to the changes, this should hopefully make it easier for people who need work with output formats other than HTML.