Hello,
With a little bit of work, I was able to get Mustache.java to work directly with Clojure data structures. The problem mentioned here (
https://groups.google.com/forum/#!topic/mustachejava/e8EjcdYUY3E) was still an issue.
It required a very thin shim so as to override the behavior in IterableCode::handle, basically it checks for Iterable first before checking for functional behavior. This picks up Clojure lists/vectors (which are also Callable) and seqs. The shim code is here:
https://github.com/billrobertson42/mustache.clojure/tree/master/java/mustache/clojure/glueI have some simple tests that exercise conversion of some basic clojure data structures, and they work fine with Clojure maps, lists, vectors, seqs and can also call Clojure functions just fine.
I have two questions.
First, Could the behavior in IterableCode::handle be changed to check for an Iterable interface before a functional interface in Mustache.java? This would eliminate the need for a separate library with shim code for Clojure's sake.
Second, Clojure maps frequently use keywords as map keys. Given the framework of Mustache.java, where would be the best place to translate key lookup in maps so that a user could pass a map with keywords for keys to a be transformed w/o having to deeply inspect and transform the input data to the template?
An example of this is in line 54 of this file.
https://github.com/billrobertson42/mustache.clojure/blob/master/test/mustache/core_test.cljThanks!