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

Access to html/template functions #3

Open
toqueteos opened this issue Apr 11, 2013 · 4 comments
Open

Access to html/template functions #3

toqueteos opened this issue Apr 11, 2013 · 4 comments

Comments

@toqueteos
Copy link

I've tried to use the printf function but I just get panics:

#{printf "%s:%s" $a $b}
{{printf "%s:%s" $a $b}}

Are html/template builtin functions allowed somehow? If so, how?

@eknkc
Copy link
Owner

eknkc commented Apr 11, 2013

Try using Go style function calls:

#{printf("%s:%s", $a, $b)}

@toqueteos
Copy link
Author

@eknkc 👍 ❤️ Oh god, finally. Thaaaanks so much. Really. Best templating library to date.

P.D: You should mention this on the docs.

@eknkc
Copy link
Owner

eknkc commented Apr 11, 2013

Thanks a lot!

You are right, there seems to be no mention about function calls on the documentation. Gonna put somthing.

@toqueteos
Copy link
Author

Also another good addition is that pipelined functions don't work. Example:
{{fn 1 | printf}} -> #{fn(1)|printf}

I don't know if that's intentional or a consequence of the templating engine (char | is used for content delimiting).

Edit: Typo, pipelined functions instead of filters.

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