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

<raw> tags are not escaping {{ }} variables #421

Closed
paambaati opened this issue Mar 11, 2021 · 7 comments
Closed

<raw> tags are not escaping {{ }} variables #421

paambaati opened this issue Mar 11, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@paambaati
Copy link

paambaati commented Mar 11, 2021

  • Maizzle Version: 3.2.0
  • Node.js Version: 15.11.0

This is essentially #171 come back. If I downgrade to framework 3.1.6, it works fine.

Example

This markup —

<raw>
    <p>Hey {{ .Name }}!</p>
</raw>

is turned to —

<p>Hey undefined!</p>

in framework 3.2.0.

@cossssmin
Copy link
Member

Looks like 394d0ae introduced this 🤦‍♂️

It's basically parsing expressions twice, so the second time it sees just <p>Hey {{ .Name }}!</p> without the <raw> tag and compiles it with the result you mentioned.

I'll have to revert that commit and try to tackle support for expressions in layout attributes right in posthtml-extend.

Thanks for spotting this!

@cossssmin
Copy link
Member

(ugly) solution until I fix this:

<raw>
    <p>Hey @{{ .Name }}!</p>
</raw>

@cossssmin
Copy link
Member

I'm looking into removing this line in the posthtml generator, now since we also run it in the layouts plugin:

expressions({...expressionsOptions, locals})

I remember there was a reason why we needed to run the expressions plugin last, but I just can't remember. Need to test this more...

@cossssmin
Copy link
Member

OK, so some of the reasons we evaluate expressions last were the <fetch> tag and possibly components.

Right now this also breaks the <fetch> tag functionality.

@cossssmin cossssmin added the bug Something isn't working label Mar 11, 2021
@cossssmin
Copy link
Member

Released v3.2.1 which reverts the 'dynamic layouts' feature - sorry about that!

Working with the PostHTML team here on maybe introducing that feature in posthtml-extend itself.

@zaarheed
Copy link

@cossssmin Thanks for turning this around so quickly. I used maizzle for the first time earlier this week and only noticed this issue when trying to generate templates to use with SendGrid. Nice to see the bug has already been sorted.

What is the best way to upgrade to v3.2.1? Update the global CLI or the dependency in package.json or both?

@cossssmin
Copy link
Member

What is the best way to upgrade to v3.2.1? Update the global CLI or the dependency in package.json or both?

Bump the @maizzle/framework dependency version number in your package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants