Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added example for issue #137

  • Loading branch information...
commit 195025f06055761f6da3a900251382e788c42d0e 1 parent beaa3a0
@olado authored
Showing with 17 additions and 1 deletion.
  1. +16 −0 examples/advancedsnippet.txt
  2. +1 −1  examples/withdoT.js
View
16 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
View
2  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) {
Please sign in to comment.
Something went wrong with that request. Please try again.