-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support additional delimiters #16
Comments
I think this line made me not do this for now: https://github.com/golang/go/blob/master/src/text/template/parse/lex.go#L531 I'm just curious, do you have a use case for this, or is this about feature parity? And what's your delimiter of choice? It's about adding the delimiters here: https://github.com/fiji-flo/gtmpl-rust/blob/master/src/lexer.rs#L103 |
I've got a project that currently implements a server in Go, and this server can take a Go template for a configuration item. Ansible is used to set up this configuration item, and I wanted the ability to be able to configure settings in this template via Ansible/Jinja2, which uses Where this comes into Rust and this library is that I'm writing a simulator in Rust for scale testing this server (and to assist in testing the server rewrite in Rust). Passing in the Go template isn't the issue from the simulator, but I'd like to be able to generate the same output in my simulator to compare against the output from the server, and this is where I'm currently looking for support for additional delimiters since the Go server is expecting Even after re-writing the server in Rust, the configuration will still occur via Ansible for the foreseeable future, so the current use case stated above will still exist for the Rust version of this server. |
I'll take a look at this when I have some free time. In the meanwhile feel free to open PR. As mentioned above, this should be a small change. However, we should add a strong warning that weird delimiters might break things (go doesn't take care of this either). |
I started to take a look at this today and have a branch here with my changes so far https://github.com/geauxvirtual/gtmpl-rust/commits/tb/add_delim_support One thing I've noticed is that in src/parse.rs, there is a test testing Display for the parsed tree, and it appears that the delimiters are hard coded when writing out the parsed tree. |
Golang allows setting the delimiters to use when parsing a template if the template is not using the default delimiters. It would be nice to have the same support here.
The text was updated successfully, but these errors were encountered: