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

The design of the set helper prevents it's use in a pipeline #26

Closed
jhillyerd opened this issue Oct 14, 2012 · 3 comments
Closed

The design of the set helper prevents it's use in a pipeline #26

jhillyerd opened this issue Oct 14, 2012 · 3 comments

Comments

@jhillyerd
Copy link

The set helper presently expects the following argument order: key, value, renderArgs

Because Go template pipelines use the result of the previous expression as the final argument, you can't use them with the set helper. Instead you must use an intermediate variable:

{{$title := printf "Title for %v" .name}}
{{set "title" $title .}}

If renderArgs was moved to the first argument of the set helper, it could be more concise:

{{printf "Title for %v" .name | set . "title"}}

I'm still learning Go, Revel and templates, so my apologies if I am incorrect.

EDIT: It would also make sense to make the same change to append

@robfig
Copy link
Contributor

robfig commented Oct 15, 2012

Ah, good point, thanks.

@bithavoc
Copy link

+1

@robfig
Copy link
Contributor

robfig commented Oct 25, 2012

Applied
robfig@10787a2

Will send a note to revel-framework google group.

Let me know if you guys end up making anything with it!

@robfig robfig closed this as completed Oct 25, 2012
kumakichi pushed a commit to kumakichi/revel that referenced this issue Nov 2, 2018
Add Install instructions - merged for now.. windows instruction to follow
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

3 participants