Skip to content
Browse files

Added/modified the description of a few examples, plus a loop example

  • Loading branch information...
1 parent 53e9572 commit 4922b5307e7534760456b7d57c444f1b9bddcb16 @pdaoust committed Nov 10, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 examples/advancedsnippet.txt
View
9 examples/advancedsnippet.txt
@@ -3,7 +3,7 @@ Advanced templating: illustrates defines and includes.
Include external snippet defined in a variable:
{{#def.externalsnippet}}
-Load external template from a file:
+Load external template from a file (using a custom loadFile() method attached to def; see /examples/withdoT.js):
{{#def.loadfile('/snippet.txt')}}
Load external template from a file and cache in a variable:
@@ -38,6 +38,7 @@ Set xyz to 1 and exclude result from output:
Compare xyz to 1, show 'xyz is not 1' if false:
{{#def.xyz === 1 || 'xyz is not 1'}}
+Conditionals to be evaluated at runtime, with conditions pre-evaluated at compile time:
{{ if ({{#!def.abc}}) { }}
{{#def.abc}} is falsy
{{ } }}
@@ -46,3 +47,9 @@ Compare xyz to 1, show 'xyz is not 1' if false:
if(true) block
{{ } }}
+Create a series of elements using a loop at runtime
+<ul>
+ {{ for (i in it.people) { }}
+ <li>My name is {{=it.people[i].firstName}}</li>
+ {{ } }}
+</ul>

0 comments on commit 4922b53

Please sign in to comment.
Something went wrong with that request. Please try again.