Permalink
Browse files

some expression demos

  • Loading branch information...
1 parent 06269f1 commit 5d07b84dc5149b7a7bd33b82fa6671ddcc2dd1c3 @stuarthalloway committed Sep 15, 2009
Showing with 26 additions and 0 deletions.
  1. +3 −0 src/clj_calendar/main.clj
  2. +22 −0 templates/expressions.st
  3. +1 −0 templates/listItem.st
@@ -21,5 +21,8 @@
(render-template "hello" {}))
(GET "/demos/stringtemplate/simple"
(render-template "simple" {:name "World"}))
+ (GET "/demos/stringtemplate/expressions"
+ (render-template "expressions" [ [:numbers (range 5)]
+ [:user {"fname" "Stu" "lname" "Halloway"}]]))
(ANY "*" (page-not-found)))
View
@@ -0,0 +1,22 @@
+<h1>Expressions Example</h1>
+
+<h2>Lists</h2>
+
+<ul>
+<li>A List: [$numbers$]</li>
+<li>A List, delimited: [$numbers; separator=", "$]</li>
+</ul>
+
+<h2>Maps</h2>
+
+<p>(Keys must be strings, not Clojure keywords)</p>
+
+<p>FN: $user.fname$, LN: $user.lname$</p>
+
+<p>Keys: $user.keys; separator=", "$</p>
+
+<h2>Multi-valued attrs</h2>
+
+<ul>
+$numbers:listItem()$
+</ul>
View
@@ -0,0 +1 @@
+<li>$it$</li>

0 comments on commit 5d07b84

Please sign in to comment.