fhd / clostache

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

Inconsistency with mustache for {{.}} #39

Open fehrenbach opened 10 years ago

fehrenbach commented 10 years ago

You can (ab)use sections and {{.}} to conditionally include passages like this in mustache:

Template: {{#foo}}quox: {{.}}{{/foo}} Data (JSON): {"foo": "bar"} Output: quox: bar

This does not work in clostache:

(render "{{#foo}}quox: {{.}}{{/foo}}" {:foo "bar"})
;=> "quox: bquox: aquox: r"

If this is not going to be addressed anytime soon, is there another way to achieve conditionals without nesting data? I want to fill a template with data from a CSV file, which is necessarily flat, so I can't just use the more reasonable {:foo {:value "bar"}} and {{#foo}} {{value}} {{/foo}}.

ikitommi commented 7 years ago

Got bitten this too. Any change to get fixed?