Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape double braces #175

Open
polybuildr opened this issue Jul 4, 2015 · 1 comment
Open

Escape double braces #175

polybuildr opened this issue Jul 4, 2015 · 1 comment

Comments

@polybuildr
Copy link

I'd prefer to use the double braces format for my variables, however, I'd like pystache to ignore certain cases, such as in this legitimate javscript snippet:

<script>!function(d,s,id){{var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){{js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}}}(document, 'script', 'twitter-wjs');</script>

What should I be doing here? True, I can just add a space between the {{, but surely Pystache supports this in some way?

@bdesham
Copy link

bdesham commented Jan 27, 2016

According to this Stack Overflow question, there’s no built-in way to escape an instance of {{. If you can’t work around it—for example, by adding a space between the braces in your example—you can change the delimiters temporarily or you can add a “braces” value to your context that will output {{ when you input {{braces}}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants