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

{{.name}} Template Variable #95

Open
derekdowling opened this issue Jan 17, 2016 · 1 comment
Open

{{.name}} Template Variable #95

derekdowling opened this issue Jan 17, 2016 · 1 comment

Comments

@derekdowling
Copy link

Hello, I am trying to get up to speed on implementing a TypeWriter based on the Set example. How do you feel about adding a "{{.name}}" template variable which is just the lowercased version of "{{.Name}". Perhaps this is simply a templating problem and there is a way I can do this myself? This is useful for things like:

{{.name}} := &{{.Name}}{}

Alternatively, I could achieve this if there was some sort of function that allows us to inject our own template helpers from the most basic information you provide us such as Pointer, Name, and any other arguments I might be missing. Is there currently a way to do any of these things?

@derekdowling derekdowling changed the title {{.name}} helper {{.name}} Template Variable Jan 17, 2016
@WnP
Copy link

WnP commented Apr 10, 2016

Here is the method to inject your proper helper functions
Here is the golang template documentation on custom function
And here a good example on how to inject a custom type
Read the source Luke ;-)

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

2 participants