A wrapper for the freemarker template engine
In its early stages, will add more features as I need them, suggestions and patches welcome
freemarker-clj is deployed on clojars
[freemarker-clj "0.2.0-SNAPSHOT"]
<dependency>
<groupId>freemarker-clj</groupId>
<artifactId>freemarker-clj</artifactId>
<version>0.2.0-SNAPSHOT</version>
</dependency>
Create a new template config
(use 'freemarker-clj.core)
(defonce cfg (gen-config))
(render cfg "template.ftl" {:some-seq [1 2 3] :some-map {:a 4 :b 5} :some-fn inc})
render
stringifies the map, replacing hyphens with underscores
You can additionally pass a shared map to the template config
(defonce cfg (gen-config :shared {:a 1 :b 2}))
(render cfg "template.ftl" {:b 3}) ; a => 1, b => 3
Copyright © 2012-2017 Sidhant Godiwala (grinnbearit)
Distributed under the Eclipse Public License, the same as Clojure.