change visiblity/name of the fn to check if a template fn has been added
This commit is contained in:
parent
15c230f0ad
commit
b02142ab47
|
@ -19,7 +19,7 @@
|
||||||
[]
|
[]
|
||||||
(reset! functions (create-function-repository)))
|
(reset! functions (create-function-repository)))
|
||||||
|
|
||||||
(defn- twig-fn-exists? [name]
|
(defn function-exists? [name]
|
||||||
(try
|
(try
|
||||||
(.retrieve @functions name)
|
(.retrieve @functions name)
|
||||||
true
|
true
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
to the template."
|
to the template."
|
||||||
[fn-name args & body]
|
[fn-name args & body]
|
||||||
`(do
|
`(do
|
||||||
(if (twig-fn-exists? ~fn-name)
|
(if (function-exists? ~fn-name)
|
||||||
(throw (new Exception (str "JTwig template function \"" ~fn-name "\" already defined.")))
|
(throw (new Exception (str "JTwig template function \"" ~fn-name "\" already defined.")))
|
||||||
(let [func# (fn ~args ~@body)
|
(let [func# (fn ~args ~@body)
|
||||||
handler# (reify JtwigFunction
|
handler# (reify JtwigFunction
|
||||||
|
|
Reference in a new issue