From 97281d6648157e88cf5f7e1622de45cf6cd41626 Mon Sep 17 00:00:00 2001 From: gered Date: Thu, 19 Jun 2014 17:34:05 -0400 Subject: [PATCH] some minor cleanups --- project.clj | 2 +- src/clojure/clj_jtwig/core.clj | 2 +- src/clojure/clj_jtwig/function_utils.clj | 1 + src/clojure/clj_jtwig/functions.clj | 9 ++++++--- src/clojure/clj_jtwig/standard_functions.clj | 2 +- test/clj_jtwig/core_test.clj | 8 ++++---- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/project.clj b/project.clj index fee61a5..34955db 100644 --- a/project.clj +++ b/project.clj @@ -1,5 +1,5 @@ (defproject clj-jtwig "0.5.1" - :description "Clojure wrapper for JTwig" + :description "Clojure wrapper for Jtwig" :url "https://github.com/gered/clj-jtwig" :license {:name "Apache License, Version 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0"} diff --git a/src/clojure/clj_jtwig/core.clj b/src/clojure/clj_jtwig/core.clj index 1da34c6..07a38c3 100644 --- a/src/clojure/clj_jtwig/core.clj +++ b/src/clojure/clj_jtwig/core.clj @@ -1,5 +1,5 @@ (ns clj-jtwig.core - "wrapper functions for working with JTwig from clojure" + "wrapper functions for working with Jtwig from clojure" (:import (com.lyncode.jtwig JtwigTemplate JtwigContext JtwigModelMap) (com.lyncode.jtwig.content.api Renderable) (com.lyncode.jtwig.configuration JtwigConfiguration) diff --git a/src/clojure/clj_jtwig/function_utils.clj b/src/clojure/clj_jtwig/function_utils.clj index e47c6fe..c743a8e 100644 --- a/src/clojure/clj_jtwig/function_utils.clj +++ b/src/clojure/clj_jtwig/function_utils.clj @@ -1,4 +1,5 @@ (ns clj-jtwig.function-utils + "utility macros for creating Jtwig function handlers. intended for internal clj-jtwig use only." (:import (com.lyncode.jtwig.functions.exceptions FunctionException) (com.lyncode.jtwig.functions.annotations JtwigFunction Parameter) (clj_jtwig TemplateFunction)) diff --git a/src/clojure/clj_jtwig/functions.clj b/src/clojure/clj_jtwig/functions.clj index 5c65493..3675594 100644 --- a/src/clojure/clj_jtwig/functions.clj +++ b/src/clojure/clj_jtwig/functions.clj @@ -10,9 +10,10 @@ (:use [clj-jtwig.standard-functions] [clj-jtwig.web.web-functions])) -(def object-array-type (Class/forName "[Ljava.lang.Object;")) -(def function-parameters (doto (GivenParameters.) - (.add (to-array [object-array-type])))) +(def ^:private object-array-type (Class/forName "[Ljava.lang.Object;")) + +(def ^:private function-parameters (doto (GivenParameters.) + (.add (to-array [object-array-type])))) (defn- add-function-library! [repository functions] (doseq [fn-obj functions] @@ -33,11 +34,13 @@ [] (reset! functions (create-function-repository))) +; intended for internal-use only. mainly exists for use in unit tests (defn get-function [^String name] (try (.get @functions name function-parameters) (catch FunctionNotFoundException ex))) +; intended for internal-use only. mainly exists for use in unit tests (defn function-exists? [^String name] (not (nil? (get-function name)))) diff --git a/src/clojure/clj_jtwig/standard_functions.clj b/src/clojure/clj_jtwig/standard_functions.clj index 92766cf..fe99773 100644 --- a/src/clojure/clj_jtwig/standard_functions.clj +++ b/src/clojure/clj_jtwig/standard_functions.clj @@ -1,5 +1,5 @@ (ns clj-jtwig.standard-functions - "standard function definitions. these are functions that are not yet included in JTwig's standard function + "standard function definitions. these are functions that are not yet included in Jtwig's standard function library and are just here to fill in the gaps for now." (:import (org.apache.commons.lang3.text WordUtils) (org.apache.commons.lang3 StringUtils)) diff --git a/test/clj_jtwig/core_test.clj b/test/clj_jtwig/core_test.clj index d9f0d64..aa3e680 100644 --- a/test/clj_jtwig/core_test.clj +++ b/test/clj_jtwig/core_test.clj @@ -4,10 +4,10 @@ [clj-jtwig.core :refer :all] [clj-jtwig.functions :refer :all])) -; The purpose of these tests is to establish that our wrapper around JTwig works. That is, +; The purpose of these tests is to establish that our wrapper around Jtwig works. That is, ; we will be focusing on stuff like making sure that passing Clojure data structures -; (e.g. maps, vectors, lists) over to JTwig works fine. -; JTwig includes its own test suite which tests actual template parsing and evaluation +; (e.g. maps, vectors, lists) over to Jtwig works fine. +; Jtwig includes its own test suite which tests actual template parsing and evaluation ; functionality, so there's no point in duplicating that kind of testing here once we ; establish that the above mentioned stuff works fine. ; @@ -48,7 +48,7 @@ (set-options! :auto-convert-map-keywords true)))) (deftest passing-model-map-data - (testing "Passing Clojure data structures to JTwigContext's" + (testing "Passing Clojure data structures to JtwigContext's" (is (= (render "float {{ x }}" {:x 3.14}) "float 3.14")