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

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

Closed
sl1m3d opened this issue Dec 12, 2012 · 5 comments
Closed

Comments

@sl1m3d
Copy link

sl1m3d commented Dec 12, 2012

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

groue commented Dec 12, 2012

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 as completed Dec 12, 2012
@groue groue reopened this Dec 12, 2012
samdeane added a commit to samdeane/GRMustache that referenced this issue Jun 29, 2013
@groue
Copy link
Owner

groue commented Jul 31, 2013

Obsoleted by #54

@groue groue closed this as completed Jul 31, 2013
@groue
Copy link
Owner

groue commented Aug 1, 2013

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

groue commented Aug 1, 2013

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

@sl1m3d
Copy link
Author

sl1m3d commented Aug 1, 2013

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
Projects
None yet
Development

No branches or pull requests

2 participants