This repository has been archived on 2019-12-12. You can view files and clone it, but cannot push or open issues/pull-requests.
tildetown-scripts/scripts/mustache.hy

17 lines
397 B
Hy
Raw Normal View History

2015-07-26 06:23:01 +00:00
(import [json [loads]])
(import [sys [argv stdin]])
(import [pystache [render]])
(defn slurp [filename]
(try
(.read (apply open [filename "r"] {"encoding" "utf-8"}))
(catch [e Exception]
"")))
(if (= __name__ "__main__")
(let [[template (-> (get argv 1)
slurp)]
[data (-> (.read stdin)
loads)]]
(print (render template data))))