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

Allow function calls in {% if %} without returning *Value #10

Closed
oal opened this issue Jul 16, 2014 · 6 comments
Closed

Allow function calls in {% if %} without returning *Value #10

oal opened this issue Jul 16, 2014 · 6 comments

Comments

@oal
Copy link

oal commented Jul 16, 2014

If I do something like {% if page.PublishTime.IsZero %}, I get a panic "function return type of 'page.PublishTime.IsZero' must be of type *Value."

It would be very convenient if at least regular functions that return a boolean could be used in if blocks. This doesn't just apply to time.Time, but also any other struct type passed into templates.

What do you think?

@flosch
Copy link
Owner

flosch commented Jul 16, 2014

It's already on my TODO-list. See #9. :-) Will work on it.

@oal
Copy link
Author

oal commented Jul 16, 2014

Sorry, I didn't notice. I started writing this issue, then had to leave for a few hours. Didn't think about checking for new issues when I came back to finish/post it, but it turns out I wasn't the only one thinking about this today. :-)

@flosch
Copy link
Owner

flosch commented Jul 16, 2014

No problem, yeah, was a coincidence. :-)

@flosch
Copy link
Owner

flosch commented Jul 16, 2014

Should be fixed now with the latest 2 commits. Any types in function arguments and return values are allowed now. Can you confirm this works for you?

@oal
Copy link
Author

oal commented Jul 16, 2014

Yes, perfect! :-) 👍

@flosch
Copy link
Owner

flosch commented Jul 16, 2014

Great. :-)

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