Closed carolynvs closed 2 years ago
@osteele I'm leaving this in draft because without extra changes this example only works in limited scenarios and probably isn't something you want to include in your godocs.
Closing since after spending all afternoon trying to figure out how to get the info I need out of the expression closures, I am not sure this is something I can contribute right now.
Thank you for the effort. If you are able to leave some notes about what information you are trying to get out of the expression closures, I can take a look at it when I get a chance. But I also am familiar with how much work it can be to try to write up something like that, and I can't guarantee I'll be able to find a solution, so please don't feel any obligation.
Add a godoc example that demonstrates how to list variable names used.
I realized when I wrote this example that it works great for us since we don't use expressions in templates like
{{ myvar | capitalize }}
. It doesn't work for expressions but it could if I exported a few more values so that I can get the bindings used in the expression context.I can submit a PR to add a few more getter functions to make this example work for more templates if that's something you would consider merging?
Below is a screenshot of the example rendered in godoc
Checklist
make test
passes.make lint
passes.