-
Notifications
You must be signed in to change notification settings - Fork 612
Add functions #32
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
Add functions #32
Conversation
Thanks! Should there be some documentation added and possibly an example on how to make use of these? |
What fun would that be? I didn't see a place in the docs that documents the current template functions, other than the de facto documentation in the examples. I suppose I could create an example or two. And now that I think about it, |
😄 yes documentation is quite lacking. If you're able to dabble down some stuff, would be great! |
I've added a "Templating" section to the README.md. In the process of writing it, I came across Hugo and it made me want to add most of their functions as well: http://gohugo.io/templates/functions/ However, I'd like to see this merged as is; I can open another PR to add more functions if (when) I get around to needing them. |
Nice! And fully agreed, docs should not uphold merging of this PR (just my opinion) Thanks a lot! |
This is failing to compile for me:
|
Crap! I had run "go test" on this branch before pushing it, but then I decided to remove a half-ass implementation of "sort". I guess that dropping that commit wasn't enough... |
Thanks! |
👍 |
Sweet! My local branch has At that point, it will be possible for everyone to use |
Sweet! |
This patch adds the following functions:
dict
: creates a map from a list of pairs. facilitates passing data to subtemplates.sha1
: creates a sha1 hex string from another stringjson
: returns the JSON string representation of an object (cf.docker inspect
)last
: returns the last element of an array or slice or the last character in a string