From b892b822215c44c3330543d4b7ae1403b08c70e5 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 1 Mar 2014 16:48:18 -0500 Subject: [PATCH] move jtwig context related option handling to make-context --- src/clj_jtwig/core.clj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/clj_jtwig/core.clj b/src/clj_jtwig/core.clj index 2b05fc4..64e68f0 100644 --- a/src/clj_jtwig/core.clj +++ b/src/clj_jtwig/core.clj @@ -37,17 +37,17 @@ (.getContextClassLoader) (.getResource filename))) -(defn- make-context [] - (new JtwigContext (new JtwigModelMap) @functions)) - -(defn- render-template - [template model-map & [{:keys [skip-model-map-stringify?] :as options}]] - (let [context (make-context)] +(defn- make-context [model-map {:keys [skip-model-map-stringify?] :as options}] + (let [context (new JtwigContext (new JtwigModelMap) @functions)] (doseq [[k v] (if-not skip-model-map-stringify? (stringify-keys model-map) model-map)] (.set context k v)) - (.output template context))) + context)) + +(defn- render-template + [template model-map & [options]] + (.output template (make-context model-map options))) (defn render "renders a template contained in the provided string, using the values in model-map