Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jinja2 escape sequence of interpreted characters

Tags:

jinja2

I would like to output {# in html, but this is the beginning of a Jinja2 comment. This is not coming from a template variable. Just plain html in my template.

Any help ?

like image 224
Thomas Avatar asked Jul 31 '14 13:07

Thomas


People also ask

How do you escape Jinja2?

You can use {{ "{" }} outside of a raw block to insert a literal curly brace followed by % endraw %} . If you are generating HTML, you could use HTML entities, like { , % and } instead of { , % and } , respectively.

Which character is an escape sequence?

An escape sequence contains a backslash (\) symbol followed by one of the escape sequence characters or an octal or hexadecimal number.

What is the Jinja2 delimiters for expressions to print to the template output?

The default Jinja delimiters are configured as follows: {% ... %} for Statements. {{ ... }} for Expressions to print to the template output.


1 Answers

Try this...

{{ '{#' }}

http://jinja.pocoo.org/docs/templates/#escaping

Hope this helps!

like image 125
Andrew Kloos Avatar answered Oct 01 '22 19:10

Andrew Kloos