Awesome
freemarker-clj
A wrapper for the freemarker template engine
In its early stages, will add more features as I need them, suggestions and patches welcome
Dependency
freemarker-clj is deployed on clojars
leiningen
[freemarker-clj "0.2.0-SNAPSHOT"]
maven
<dependency>
<groupId>freemarker-clj</groupId>
<artifactId>freemarker-clj</artifactId>
<version>0.2.0-SNAPSHOT</version>
</dependency>
Usage
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
Contributors
License
Copyright © 2012-2017 Sidhant Godiwala (grinnbearit)
Distributed under the Eclipse Public License, the same as Clojure.