python - Pystache without escaping (unescaped) -


i'm using pystache render templates. i'm getting & in output when render context variables having &. how can rid of & need & . same thing happening django templating

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

to prevent escaping use triple braces {{{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 on recent release of today, version 0.5.4

mustache documentation

since pystache mustache implementation in python, can use mustache's documentation pointers.

all variables html escaped default. if want return unescaped html, use triple mustache: {{{name}}}.

source: https://mustache.github.io/mustache.5.html


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -