diff --git a/src/clj_jtwig/core.clj b/src/clj_jtwig/core.clj index 41d218e..c561617 100644 --- a/src/clj_jtwig/core.clj +++ b/src/clj_jtwig/core.clj @@ -107,7 +107,7 @@ (defn- make-model-map [model-map-values] (let [model-map-obj (new JtwigModelMap) - values (if (:stringify-keys @options) + values (if (:stringify-model-map-keys @options) (stringify-keys model-map-values) model-map-values)] (doseq [[k v] values] diff --git a/src/clj_jtwig/options.clj b/src/clj_jtwig/options.clj index 6d20e15..dde2336 100644 --- a/src/clj_jtwig/options.clj +++ b/src/clj_jtwig/options.clj @@ -33,4 +33,6 @@ ; whether or not to automatically stringify the keys of model-maps. Jtwig requires that all ; the keys will be strings for model value resolution to work correctly. if you are already ; setting your keys as maps, then you can turn this option off to save a bit on performance - :stringify-keys true})) \ No newline at end of file + :stringify-model-map-keys true + + })) \ No newline at end of file diff --git a/test/clj_jtwig/core_test.clj b/test/clj_jtwig/core_test.clj index 24b59f6..78f3c89 100644 --- a/test/clj_jtwig/core_test.clj +++ b/test/clj_jtwig/core_test.clj @@ -29,16 +29,16 @@ "Hello Bob!") "passing a model-map where the keys are strings already") (do - (set-options! :stringify-keys false) + (set-options! :stringify-model-map-keys false) (is (= (render "Hello {{ name }}!" {"name" "Bob"}) "Hello Bob!") "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") - (set-options! :stringify-keys true)) + (set-options! :stringify-model-map-keys true)) (do - (set-options! :stringify-keys false) + (set-options! :stringify-model-map-keys false) (is (thrown? ClassCastException @@ -46,7 +46,7 @@ {:name "Bob"})) "passing a model-map where the keys are keywords and try skipping auto stringifying the keys") - (set-options! :stringify-keys true)))) + (set-options! :stringify-model-map-keys true)))) (deftest passing-model-map-data (testing "Passing Clojure data structures to JTwigContext's" @@ -117,16 +117,16 @@ "Hello Bob from a file!") "passing a model-map where the keys are strings already") (do - (set-options! :stringify-keys false) + (set-options! :stringify-model-map-keys false) (is (= (render-file test-filename {"name" "Bob"}) "Hello Bob from a file!") "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") - (set-options! :stringify-keys true)) + (set-options! :stringify-model-map-keys true)) (do - (set-options! :stringify-keys false) + (set-options! :stringify-model-map-keys false) (is (thrown? ClassCastException @@ -134,4 +134,4 @@ {:name "Bob"})) "passing a model-map where the keys are keywords and try skipping auto stringifying the keys") - (set-options! :stringify-keys true))))) + (set-options! :stringify-model-map-keys true)))))