Closed elgalu closed 6 years ago
Unfortunately that's not possible. Yasha's file extensions support only classes derived from jinja2.ext.Extension
, not jinja2.Environment
. However, I would like to support Environments too as I have had plans to use Yasha for Latex, see #31 and #33.
Thanks for the prompt response @kblomqvist and very glad to read its on your plans:)
Can you point me where in there source could I hard-code this settings? until is done "properly" ?
A note to myself. Jinja's defaults could be overridden by local keys defined in Yasha's file extensions.
# extension.py
BLOCK_START_STRING = '{%'
BLOCK_END_STRING = '%}'
VARIABLE_START_STRING = '{{'
VARIABLE_END_STRING = '}}'
COMMENT_START_STRING = '{#'
COMMENT_END_STRING = '#}'
LINE_STATEMENT_PREFIX = None
LINE_COMMENT_PREFIX = None
TRIM_BLOCKS = False
LSTRIP_BLOCKS = False
NEWLINE_SEQUENCE = '\n'
KEEP_TRAILING_NEWLINE = False
@elgalu Could you try if https://github.com/kblomqvist/yasha#template-syntax works for you?
Works!! Thanks
Hi, I'm trying to override certain Jinja2 environment defaults like
block_start_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 thatjinja_env
I'm creating.Thanks for maintaining this project!