I'd like to use polymer in a Python/Flask project. Flask uses the Jinja2 templating engine, which also uses the double curly braces {{}} as delimiters.
Escaping braces in Jinja2 is possible, but it results in very ugly and unreadable code I'd like to avoid.
Although it's also possible to change the delimiters in Jinja2, I'd rather change them in Polymer, because we already use some Jinja2 templates in the project.
So the question is, is it possible to change the delimiters in Polymer, and if so, how do we go about that?
Thanks
In the templates module, when initializing the jinja2 environment you can pass optional start/stop delimiters:
environment = jinja2.Environment(loader=loader, trim_blocks=True,block_start_string='@@',block_end_string='@@',variable_start_string='@=', variable_end_string='=@')
would change {% statement %} to @@ statement @@ and {{ var }} into @= var =@.
Make it a config option and only pass if set, otherwise jinja will use its own defaults.
credits: Brian Coca Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With