diff --git a/examples/advancedsnippet.txt b/examples/advancedsnippet.txt index fe735e1..a8c3b89 100644 --- a/examples/advancedsnippet.txt +++ b/examples/advancedsnippet.txt @@ -116,4 +116,20 @@ Array iterators {{#def.block1:{a:1, b:2} || ''}} +{{##def.testFunctionWithParam = function(str) { + return "My name is: " + str; + } +#}} + +{{##def.mytestparam: {{=it.name}} #}} +{{#def.testFunctionWithParam(def.mytestparam)}} + +{{#def.testFunctionWithParam("\{\{=it.name\}\}")}} + +{{##def.testParamDef:myparam: +My name is: {{=myparam}} +#}} + +{{#def.testParamDef:it.name}} + The end diff --git a/examples/withdoT.js b/examples/withdoT.js index 5eea573..0ee47ba 100644 --- a/examples/withdoT.js +++ b/examples/withdoT.js @@ -1,7 +1,7 @@ (function() { var doT = require('../doT.js'), fs = require('fs'), - data = { f1: 1, f2: 2, f3: 3, altEmail: "conditional works", farray:[{farray:[1,2,3,[11,22,33]],person:{name:'Ell',age:23}},{farray:{how:'really'}}, {farray:[5,6,7,8]}]}, + data = { name: "Foo", f1: 1, f2: 2, f3: 3, altEmail: "conditional works", farray:[{farray:[1,2,3,[11,22,33]],person:{name:'Ell',age:23}},{farray:{how:'really'}}, {farray:[5,6,7,8]}]}, defs = { a: 100, b: 200}; defs.loadfile = function(path) {