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

How to deal with single quotes in locals? #389

Closed
raphaelgoetter opened this issue Jan 6, 2021 · 5 comments
Closed

How to deal with single quotes in locals? #389

raphaelgoetter opened this issue Jan 6, 2021 · 5 comments

Comments

@raphaelgoetter
Copy link

raphaelgoetter commented Jan 6, 2021

  • Maizzle Version: 3.0.1
  • Node.js Version: 14

Hello,

I need to display single quotes in my locals values (in my screenshot Villeneuve d'Ascq) , but json refuses them (even when escaped).

Do you have a solution?

Capture d’écran 2021-01-06 à 09 37 29

@cossssmin
Copy link
Member

You could replace the single quote with an HTML entity, like ’ or ':

<component locals='{
    "mediaPlace": "Stade Pierre Mauroy, Villeneuve d&rsquo;Ascq"
  }'>Réserver</component>

When using HTML entities, your component should use triple curly braces for outputting variables:

- {{ mediaPlace }}
+ {{{ mediaPlace }}}

@raphaelgoetter
Copy link
Author

Could work, thank you 👍

@raphaelgoetter
Copy link
Author

When using HTML entities, your component should use triple curly braces for outputting variables:

Also, is there a documentation for this? Didn't find it.

@cossssmin
Copy link
Member

You're right, missed it, need to add it to our docs as well.

https://github.com/posthtml/posthtml-expressions#unescaped-locals

@cossssmin
Copy link
Member

Added:

https://maizzle.com/docs/templates/#unescaping-variables

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