I'm using pystache to render the templates. I'm getting &
in the output when I render context variables having &. How can get rid of &
where I need & .
Same thing is happening with django templating as well
>>> pystache.render('The URL {{URL}}', {'URL': 'http://google.com?a=3&b=3'})
u'The URL http://google.com?a=3&b=3'
{{{var}}}
To prevent escaping, use triple braces, {{{URL}}}
instead of double 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've tested this on the most recent release as of today, version 0.5.4
Since Pystache is a Mustache implementation in Python, you can use Mustache's documentation as pointers.
All variables are HTML escaped by default. If you want to return unescaped HTML, use the triple mustache: {{{name}}}.
source: https://mustache.github.io/mustache.5.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With