noahmorrison / chevron

A Python implementation of mustache
MIT License
505 stars 55 forks source link

Add option for skipping escaping #92

Closed bsergean closed 3 years ago

bsergean commented 3 years ago

Hi there,

I tried using chevron this morning but I couldn't find a way to prevent escaping of some string. I am trying to generate C++ with double quotes, and those gets escaped to html &...; which I don't want.

pystache can do that by passing a lambda that does nothing to the escape parameter of the Renderer. Not sure how to do that with chevron, it sounds like boolean escape=False, defaulting to True would do it.

dcmoore-gd commented 3 years ago

Have you tried using triple braces {{{...}}}?

bsergean commented 3 years ago

I did not. Let me try it.

Is that a standard mustache syntax ?

On Feb 24, 2021, at 1:44 PM, Dan Moore notifications@github.com wrote:

Have you tried using triple braces {{{...}}}?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/noahmorrison/chevron/issues/92#issuecomment-785405168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2O6UNPYKB4DIMMUGSAYF3TAVXNBANCNFSM4YFFOXDQ.

bsergean commented 3 years ago

Just found that in the spec. Thanks ! All variables are HTML escaped by default. If you want to return unescaped HTML, use the triple mustache: {{{name}}}.

On Feb 24, 2021, at 1:44 PM, Dan Moore notifications@github.com wrote:

Have you tried using triple braces {{{...}}}?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/noahmorrison/chevron/issues/92#issuecomment-785405168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2O6UNPYKB4DIMMUGSAYF3TAVXNBANCNFSM4YFFOXDQ.

bsergean commented 3 years ago

Works great / I was using pystache but I'm now using chevron. Thanks for the tip !

dcmoore-gd commented 3 years ago

You're welcome!