Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency with mustache for {{.}} #39

Open
fehrenbach opened this issue May 28, 2014 · 1 comment
Open

Inconsistency with mustache for {{.}} #39

fehrenbach opened this issue May 28, 2014 · 1 comment

Comments

@fehrenbach
Copy link

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
Copy link

Got bitten this too. Any change to get fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants