hogan.js: Mustache compiler from Twitter
Hogan is a console compiler for Mustache templates, complete with a fantastic name and man page.
Aiming not only for speed, Hogan boasts a parser API:
var text = "{{^check}}{{i18n}}No{{/i18n}}{{/check}}";
text += "{{#check}}{{i18n}}Yes{{/i18n}}{{/check}}";
var tree = Hogan.parse(Hogan.scan(text));
// outputs "# check"
console.log(tree[0].tag + " " + tree[0].name);
// outputs "Yes"
console.log(tree[1].nodes[0].nodes[0]);
Discussion
Sign in or Join to comment or subscribe