How do I resolve a conflict between Handlebars and Jinja, since the syntax of both are similar?
How do I resolve a conflict between Handlebars and Jinja, since the syntax of both are similar?
Well, I have a different option and maybe it's better. How about changing the delimit of jinja2?
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
comment_end_string='#>',
))
app = CustomFlask(__name__)
Follow the link for more details - > link
You can use the raw
tag that will disregard what's inside its block:
{% raw %}
{{ title }}
{% endraw %}
In this case, title
will not be computed by jinja.
Another, slightly dirtier, way is to use a variable expression:
{{ '{{' }}title{{ '}}' }}
Take a look at jinja documentation if you have questions.