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: customizable escape function #125

Open
redsun82 opened this issue Nov 24, 2023 · 4 comments
Open

Feature request: customizable escape function #125

redsun82 opened this issue Nov 24, 2023 · 4 comments

Comments

@redsun82
Copy link

It' be nice to be able to pass an escaping function to accommodate instantiating templates for non-html languages. Pystache supports this via an escape parameter. As a use case, I use mustache templates in C++ code generation, where escaping & breaks everything. I can explicitly unescape things in the templates, but it's just easier to pass escape=lambda x: x. JSON string escaping comes to mind as another use case.

@shahargl
Copy link

shahargl commented Mar 20, 2024

@redsun82 did you manage to workaround this?

@redsun82
Copy link
Author

redsun82 commented Mar 21, 2024

@shahargl not really, I filed this when I was considering porting my code from pystache to chevron, but this was a blocker, so I just kept pystache

@shahargl
Copy link

@redsun82 Got you. Why did you consider moving? I see pystache last commit is 10 years ago, do you have any problem with it?

@redsun82
Copy link
Author

redsun82 commented Mar 21, 2024

@shahargl pystache works reasonably ok, but it's not up to date with the mustache spec. In particular I was interested in parents with overrideable blocks, which would simplify a bit my templates, but are not supported by pystache.

Obviously a workaround for this specific issue to use chevron is to consistently use {{{...}}} in the templates instead of {{...}}, but that adds a bit of visual noise to the template files.

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