Playground
Based on the excellent
DoT.js
website
Template
Hi {{log("Hope you like Squirrelly!")/}} {{ htmlstuff }} {{ foreach(options.obj) }} Reversed value: {{@this|reverse}}, Key: {{@key}} {{if(@key==="thirdchild")}} {{each(options.obj[@key])}} Salutations! Index: {{@index}}, old key: {{@../key}} {{/each}} {{/if}} {{/foreach}} {{ customhelper() }} {{#cabbage}} Cabbages taste good {{#pineapple}} As do pineapples {{/customhelper}} This is a partial: {{include("mypartial")/}} {{tags(--,--)/}} Custom delimeters! --arr--
Sqrl.Compile()
Data
"htmlstuff": "
alert('hey')
alert('hey')
alert('hey')
", "arr": ["Hey", "
Malicious XSS
", "Hey", 3, 12], "obj": { "firstchild": "HI", "secondchild": "HEY", "thirdchild": [3, 6, 3, 2, 5, 4] }
Result