UNPKG

phnq_ejs

Version:

Embedded JavaScript templating tool

41 lines (39 loc) 606 B
it should correctly invoke a function (expression style) with a body ========== { _locals: { withBodyNoArgs: function(fn) { var x = 10; var y = 5; var buf = []; fn(buf); return "<<< " + (x+y) + ", " + buf.join("").trim() + " >>>"; }, withBodyArgs: function(x, y, fn) { var buf = []; fn(buf); return "<<< " + (x+y) + ", " + buf.join("").trim() + " >>>"; }, add: function(x, y) { return x+y; } } } ========== ONE {withBodyNoArgs} YO {/withBodyNoArgs} {withBodyArgs 10, 20} {add 1, 2/} {/withBodyArgs} THREE ========== ONE <<< 15, YO >>> <<< 30, 3 >>> THREE