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

escaping " #13

Closed
wailqill opened this issue Mar 11, 2010 · 5 comments
Closed

escaping " #13

wailqill opened this issue Mar 11, 2010 · 5 comments

Comments

@wailqill
Copy link

I'm having problems with a template where I use Mustache to set the attribute value and it's containing a ".

In the escpae method i see this:

case '"': return '\"';

which should maybe be:

case '"': return '\\"';

But that doesn't work in this case:

$.mustache('<must ache="oo{{attr}}oo">Ook!</must>', { attr: '"' })
// => "<must ache="oooo">Ook!</must>"

Both cases just remove it since it needs to be htmlified.

This works:

case '"': return "&quot;"
// => "<must ache="oo&quot;oo">Ook!</must>"
@janl
Copy link
Owner

janl commented Mar 11, 2010

Can you use {{{attr}}}?

@wailqill
Copy link
Author

No, the problem is the opposite. I want to have it encoded. Just to &quot; not \"

A followup question is why you decided to escape it to \" and not to &quot; like the rest of the chars? Was it based on an actual need in some situation?
I couldn't find a test in your solution that actually tested it, I only found the one that tested the > character.

@janl
Copy link
Owner

janl commented Mar 24, 2010

I just used the escaping map from defunk/mustache.

Entitifying is not something Mustache does (yet). I'm looking for a way to easily add service hooks into Mustache.js, the Twitter guys have custom _i tags they use for i18n, I'd like to make these extensions pluggable.

@wailqill
Copy link
Author

That sounds like a good idea!

@janl
Copy link
Owner

janl commented Apr 26, 2010

you can now use higher-order sections to add custom filters.

This issue was closed.
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

3 participants
@wailqill @janl and others