How to override Jinja2 block_start_string
See original GitHub issueHi, I’m trying to override certain Jinja2 environment defaults like block_start_string
:
import jinja2
jinja_env = jinja2.Environment(
block_start_string = '<%',
block_end_string = '%>',
variable_start_string = '<<',
variable_end_string = '>>'
)
I’m loading that extension file with yasha -e my_extension.py
however it doesn’t take effect as I don’t know how to activate that jinja_env
I’m creating.
Thanks for maintaining this project!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Change the block start string in Django templates
Django does not currently support changing the block start or end strings, however Django does support using Jinja2 as a template backend.
Read more >template module does not interprets the custom jinja2 ... - GitHub
Summary below template adds custom jinja2 environment settings #jinja2:variable_start_string:'[%' , variable_end_string:'%]' ...
Read more >Template - jancy
Since Ansible version 0.9, templates are loaded with C(trim_blocks=True). Also, you can override jinja2 settings by adding a special header to template file....
Read more >jigo package - github.com/jmoiron/jigo - Go Packages
Jigo is a Jinja2-like template language for Go. It is in pre-alpha stages and not yet ready for use much less production. Any...
Read more >cannot import name 'soft_unicode' from 'markupsafe' jupyter ...
File "C:\Users\NXHSE\anaconda3\lib\site-packages\jinja2\filters.py", line 13, ... import BLOCKSTARTSTRING 27 from .defaults import COMMENTENDSTRING.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/kblomqvist/yasha/blob/master/yasha/yasha.py#L127
Works!! Thanks