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

remove eq argument limitation #6237

Closed
regisphilibert opened this issue Aug 17, 2019 · 0 comments · Fixed by #6303

Comments

@regisphilibert
Copy link

commented Aug 17, 2019

I recently stumbled on this in the Go Template doc:

For simpler multi-way equality tests, eq (only) accepts two or more arguments and compares the second and subsequent to the first, returning in effect

arg1==arg2 || arg1==arg3 || arg1==arg4 ...

We'd be inclined to write the following.

    {{ $test := "bonjour" }}
    {{ $bool :=  in (slice "bonjour" "goodbye" "ciao") $test }}
    {{*/ becomes /*}}
    {{ $bool :=  eq $test "bonjour" "goodbye" "ciao" }}

Hugo errors wrong number of args for eq: want 2 got 4 at the moment.

It's obviously not critical but could help readability and align Hugo with Go Template.

@bep bep added the Enhancement label Aug 17, 2019

@bep bep added this to the v0.58 milestone Aug 17, 2019

@bep bep modified the milestones: v0.58, v0.59 Sep 2, 2019

vazrupe added a commit to vazrupe/hugo that referenced this issue Sep 3, 2019
vazrupe added a commit to vazrupe/hugo that referenced this issue Sep 3, 2019
vazrupe added a commit to vazrupe/hugo that referenced this issue Sep 3, 2019

@bep bep closed this in #6303 Sep 5, 2019

bep added a commit that referenced this issue Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.