Skip to content

Commit 195025f

Browse files
committed
added example for issue #137
1 parent beaa3a0 commit 195025f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

examples/advancedsnippet.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,20 @@ Array iterators
116116

117117
{{#def.block1:{a:1, b:2} || ''}}
118118

119+
{{##def.testFunctionWithParam = function(str) {
120+
return "My name is: " + str;
121+
}
122+
#}}
123+
124+
{{##def.mytestparam: {{=it.name}} #}}
125+
{{#def.testFunctionWithParam(def.mytestparam)}}
126+
127+
{{#def.testFunctionWithParam("\{\{=it.name\}\}")}}
128+
129+
{{##def.testParamDef:myparam:
130+
My name is: {{=myparam}}
131+
#}}
132+
133+
{{#def.testParamDef:it.name}}
134+
119135
The end

examples/withdoT.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function() {
22
var doT = require('../doT.js'),
33
fs = require('fs'),
4-
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]}]},
4+
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]}]},
55
defs = { a: 100, b: 200};
66

77
defs.loadfile = function(path) {

0 commit comments

Comments
 (0)