Skip to content

Commit

Permalink
clj api: make render! fn work with data map of keyword keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Erdos committed Oct 21, 2018
1 parent 9e86772 commit 1243b55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/stencil/api.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns stencil.api
"A simple public API for document generation from templates."
(:require [clojure.walk :refer [stringify-keys]])
(:import [io.github.erdos.stencil API PreparedTemplate TemplateData]))

(set! *warn-on-reflection* true)
Expand All @@ -15,7 +16,7 @@

(defn- make-template-data [x]
(if (map? x)
(TemplateData/fromMap ^java.util.Map x)
(TemplateData/fromMap ^java.util.Map (stringify-keys x))
(throw (ex-info (str "Unsupported template data type " (type x) "!")
{:template-data x}))))

Expand Down

0 comments on commit 1243b55

Please sign in to comment.