Created
August 19, 2009 15:30
-
-
Save wilkes/170406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn render-template | |
"Loads a StringTemplate off the classpath and binds the params" | |
[template-name & params] | |
(doto (. (StringTemplateGroup. "tmpls") getInstanceOf template-name) | |
(set-attrs! (partition 2 params)))) | |
(defn set-attrs! [t attr-pairs] | |
(doseq [[k v] attr-pairs] | |
(. t setAttribute (name k) v))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment