Skip to content

Instantly share code, notes, and snippets.

@wilkes
Created August 19, 2009 15:30
Show Gist options
  • Save wilkes/170406 to your computer and use it in GitHub Desktop.
Save wilkes/170406 to your computer and use it in GitHub Desktop.
(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