Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

How can you pass in a literal value from a template into to a filter? #37

Closed
psybert opened this Issue · 5 comments

2 participants

@psybert

trying to do something like this:
{{date_format(date,"yyyy-MM-dd 'at' HH:mm")}}

or

{{#equals(name,"fred")}}this guys name is short for fredrick! {{/}}

I see a path for the second scenario but that involves adding a @{@"fred" : @"fred"} to the context which seems silly.

@groue
Owner

Hi Rob.

There is, today, no way to write literals such as strings and numbers in the tag content.

I would consider a pull request with the greatest interest.

In the meantime, put your format in the data, as in https://gist.github.com/3803707.

@groue groue closed this
@groue groue reopened this
@groue groue referenced this issue in mustache/spec
Open

Feature Request: Inline partials #63

@samdeane samdeane referenced this issue from a commit in samdeane/GRMustache
@samdeane samdeane Experimental implementation of issue #37. dfa169e
@samdeane samdeane referenced this issue
Closed

Filter literals #54

@groue
Owner

Obsoleted by #54

@groue groue closed this
@groue
Owner

The pull request #54 contains sample code that lets you render, for instance, the following template:

foo: {{ "foo" }}, FOO: {{ uppercase("foo") }}

as:

foo: foo, FOO: FOO
@groue
Owner

@psybert Check the sample code at #54 (comment) : literals have finally found their solution.

@psybert

Yea this looks awesome. Can't wait to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.