Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated documentation

  • Loading branch information...
commit f5c6453ead064f20e37e4b66065838e34181806c 1 parent 8d13a16
Stathis Sideris authored July 12, 2011

Showing 1 changed file with 18 additions and 1 deletion. Show diff stats Hide diff stats

  1. 19  README.md
19  README.md
Source Rendered
@@ -86,7 +86,24 @@ Often you will need to generate code for a series of fields that are already dec
86 86
 
87 87
 This produces the same result as above. In a similar vein, the `first-alphas` function allows you to extract the variable names from lines such as `firstName.set(null);`.
88 88
 
89  
-Also, as you can see in the example above, if the placeholder starts with parenthesis, it is evaluated as a Clojure expression. In this case the placeholder variable name **has** to be `x`. You can use any expression you like, but javamatic provides a few string manipulation functions. See the *string manipulation* section of the source for a full list.
  89
+Also, as you can see in the example above, if the placeholder starts with parenthesis, it is evaluated as a Clojure expression. The expression can use any of the passed variables if you are using multiple variables, otherwise `x` is used, as in normal placeholders. You can use any expression you like, but javamatic provides a few string manipulation functions. See the *string manipulation* section of the source for a full list.
  90
+
  91
+Here is an example of an evaluated placeholder using multiple variables (not very useful, but hey):
  92
+
  93
+````clojure
  94
+    (print (render-template 
  95
+	    "{{a}} + {{b}} = {{(+ a b)}}\n"
  96
+		{:a [4 5 7 33] :b [4 2 1 10]}))
  97
+````
  98
+
  99
+...and we get:
  100
+
  101
+````java
  102
+    4 + 4 = 8
  103
+    5 + 2 = 7
  104
+    7 + 1 = 8
  105
+    33 + 10 = 43
  106
+````
90 107
 
91 108
 ### The pastebox
92 109
 

0 notes on commit f5c6453

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