flask - Escape jinja2 syntax in a jinja2 template -


i serve dynamic pages jinja2 templates in flask. defining client-side templates in say, jinja2-clone nunjucks inside script tag. problem is, client-side templates has syntax <% %> flask's jinja2 interpreter may interpret instead of rendering verbatim.

how can make entire block of scripts render verbatim?

you can disable interpretation of tags inside {% raw %} block:

{% raw %}  in block treated raw text, including {{ curly braces }} , {% other block-like syntax %}  {% endraw %} 

see escaping section of template documentation.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -