         (conj! template (.toString sb))
         (persistent! template))))
 
-#_(render (parse "home.html") {:name "Bob"})
+#_(render (parse "home.html") {:name "Bob" :users [[{:name "test" }] [{:name "test1" }]]})

#_(render (tag-content "endfor" (java.io.StringReader. "foo {{name.first}} bar {% endfor %}")) {:name {:first "Bob"}})
;"foo Bob bar "

(defn for-hanlder [[id _ ids] rdr]
  (let [content (tag-content "endfor" rdr)        
        id (map keyword (.split id "\\."))
        ids (keyword ids)]
    (fn [args]      
      (for [value (get args ids)]
        (render content (assoc args id value))))))

(def expr-tags
  {:for {:handler for-hanlder}

(declare parse expr-tag)

(defn render [template args]  
  (let [buf (StringBuilder.)]
    (doseq [element template]       
      (.append buf (if (string? element) element (element args))))
    (.toString buf)))

(defn read-char [rdr]
  (let [ch (.read rdr)]
