-
Notifications
You must be signed in to change notification settings - Fork 51
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
Attributes keys do not behave like current (4.0.0) haml version #65
Comments
The reason why Haml has this feature is that the Hash syntax needs to be a valid Ruby Hash, thus %p{ data: { my-attr: 'content' }} will produce a syntax error. But this is not true for Haml Coffe, where the above template compiles fine and results in the expected HTML. So why do you want to write the attribute with an underscore and have Haml Coffe convert it for you, when you simply can write it in the desired way from the beginning? |
Because it is the Ruby way 😃. As you point out the above is not valid Ruby and so it is not valid Haml. See: http://haml.info/docs/yardoc/file.REFERENCE.html#attributes
And why would I want to write Haml in two different ways, from which one is not even valid Haml? I always have to remember if I am in an haml-coffee file or in a regular haml file. I can not simple copy paste 'static' haml from one file to the other. And I think it is inconsistent behavior. I also could write it as: %p( data-my-attr: "content") But I just do not want to write my Haml this way 😉. That said: I really linke this project and you done a great job! Thx! |
Agree, those are valid arguments. Thanks for coming up with the issue and pointing me to the right direction. |
The current haml version converts underscores in attribute keys to dashes:
Source:
%p{ data: { my_attr: 'content' }}
Current output:
Expected output (from Haml 4.0.0):
More Info: http://haml.info/docs/yardoc/file.REFERENCE.html#html5_custom_data_attributes
The text was updated successfully, but these errors were encountered: