Skip to content

Inconsistency with mustache for {{.}} #39

Description

@fehrenbach

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}}.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions