A Clojure wrapper around StringTemplate.
This is a Proof of concept. Do not use in production.
(require '[com.github.akond.string-template.core :as st])
(let [t (st/template "Hello, <name>!")]
(-> t (merge {:name "world"}) str))
=> "Hello, world!"
(let [g (st/group (io/file "example.stg"))]
(-> g :greet (merge {:hellos ["Hi" "Guten morgen" "Buenos dias"]}) print))
=>
Hi, world!
Guten morgen, world!
Buenos dias, world!
File example.stg
:
greet(hellos) ::= <<
<hellos: world()>
>>
world(item) ::= <<
<item>, world!
>>
See more examples in the tests.
Can you improve this documentation? These fine people already did:
Toropenko Sergey & Sergey ToropenkoEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close