fhd / clostache

{{ mustache }} for Clojure
GNU Lesser General Public License v3.0
318 stars 62 forks source link

provide empty data map to render and render-resource #24

Closed ryancole closed 11 years ago

ryancole commented 11 years ago

I'm not sure if this is something you'd want to allow or not. I've used some other mustache template libs, in other languages, that allowed this. Anyway, I'm also new to Clojure so this may or may not be the best way to go about this. This was just a possible way to do it that I saw.

This adds another overloaded render and render-resource that simply provide an empty map if they're only passed in a single parameter.

This is useful because it still allows you to take advantage of various features of this lib, even if you don't explicitly need a data map.

JulianBirch commented 11 years ago

I think I would rather that (render "{{a}}") performed currying, than rendered with an empty data map.

So

(is (=
     ((render a) b)
     (render a b))

Ideally, it would compile the template first.

fhd commented 11 years ago

@JulianBirch I think I'd rather have that in a separate function (e.g. compile), since it would be inconsistent with how render behaves with 2 or 3 parameters. (That said, I fear precompiling templates would be quite the effort, considering how clostache is implemented right now.)

fhd commented 11 years ago

Merged, thanks! I'm sorry it took a while.