Conflict between Jinja and Handlebars

4

How do I resolve a conflict between Handlebars and Jinja, since the syntax of both are similar?

    
asked by anonymous 26.11.2015 / 20:07

2 answers

0

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

    
29.11.2015 / 07:19
2

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.

    
26.11.2015 / 20:28