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

Feature Request: Extensible/Customizable Value Escaping #32

Open
Zulu-Inuoe opened this issue Feb 20, 2020 · 1 comment
Open

Feature Request: Extensible/Customizable Value Escaping #32

Zulu-Inuoe opened this issue Feb 20, 2020 · 1 comment

Comments

@Zulu-Inuoe
Copy link
Contributor

I recently had the need to generate a URL from a mustache template. Because in these cases the values must be url-encoded rather than HTML escaped, it would have been very helpful to have conntrol over the mustache::escape function.
While there's other workarounds for this, I think a worthwhile feature would be for mustache to expose some mechanism for controlling the escaping performed on template renderings.

I think a reasonable implementation could be to define a mustache:*escape-function* variable which callers to mustache:render could bind. And/or, an additional optional or keyword parameter to mustache:render to achieve similar.

I'm happy to implement but I'd like some feedback/thoughts.

Thanks!

@kanru
Copy link
Owner

kanru commented Feb 20, 2020

I merged #26 which adds *escape-tokens* so you can turn it on or off. It would be nice if you can customize the escape function too!

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