Pystache without escaping (without escaping)

I use pystache to display patterns. I get &in output when I process context variables having &. How to get rid of &where I need to, and. The same thing happens with django templates

>>> pystache.render('The URL {{URL}}', {'URL': 'http://google.com?a=3&b=3'})
u'The URL http://google.com?a=3&b=3'
+4
source share
1 answer

Use triple braces to avoid shielding {{{var}}}

To avoid escaping, use triple curly braces {{{URL}}}instead of double curly braces{{URL}}

>>> pystache.render('The URL {{{URL}}}', {'URL': 'http://google.com?a=3&b=3'})
u'The URL http://google.com?a=3&b=3'

I tested this in the latest version to date, version 0.5.4

Mustache Documentation

Pystache - Mustache Python, Mustache .

HTML. unescaped HTML, : {{{name}}}.

: https://mustache.imtqy.com/mustache.5.html

+3

Source: https://habr.com/ru/post/1624598/


All Articles