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

Haml 5 is automatically escaping Angular code with quotes #1038

Closed
raelgc opened this issue Aug 21, 2020 · 6 comments
Closed

Haml 5 is automatically escaping Angular code with quotes #1038

raelgc opened this issue Aug 21, 2020 · 6 comments

Comments

@raelgc
Copy link

raelgc commented Aug 21, 2020

I have the following Angular snippet:

%a{'ng-click': "showModal('policies.tpl.html')"}Privacy Policy

Which works fine under Haml 4.

I've upgrade to Haml 5.1.2, and now this is rendered as:

<a ng-click='showModal(&#39;policies.tpl.html&#39;)'>Privacy Policy</a>

I tried to configure an initializer do not escape stuff like this:

# config/initializers/haml.rb

# See more options in the documentation: https://haml.info/docs/yardoc/Haml/Options.html
Haml::Template.options[:escape_filter_interpolations] = false
Haml::Template.options[:escape_html] = false

But I still have the same output.

@HamptonMakes
Copy link
Member

are you using any frameworks with this?

@bigethan
Copy link

bigethan commented Oct 7, 2020

experiencing something similar but I'm ahead of you version wise (going from Haml 5.1.2 to 5.2.0)... and it feels related to #1015 but not completely sure yet. It certainly involves apostrophes getting converted to &#39; in a javascript template defined in haml where previously they weren't

- class_name = "requested-field {{= required ? 'required' : '' }}".html_safe

@raelgc
Copy link
Author

raelgc commented Oct 7, 2020

@bigethan After some tests, it worked for me using escape_attrs:

# config/initializers/haml.rb

# See more options in the documentation: https://haml.info/docs/yardoc/Haml/Options.html
# Haml::Template.options[:escape_filter_interpolations] = false
Haml::Template.options[:escape_html] = false
Haml::Template.options[:escape_attrs] = false

@bigethan
Copy link

bigethan commented Oct 7, 2020

ah! nice, seems to be this commit then #1028 :-) thanks for the followup!

@HamptonMakes
Copy link
Member

Looks like it got solved! <3

@bigethan
Copy link

to follow up, these configs didn't fix our issues with the change, we'll likely need to revisit how we're encoding things.

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