-
Notifications
You must be signed in to change notification settings - Fork 109
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
Multiline attributes fail #74
Comments
In case someone else ends up here, you can always do the most horrible thing and use a proper implementation of HAML like I did to monkey-patch karma-haml-preprocessor. I'll be happy to revisit the problem in the future, this was my "need it to work now" fix. |
@Sinetheta - super-hoping you revisit this +1 re: defect |
A similar, unrelated defect: the multiline pipe setup is also not honored according to the standard |
@Sinetheta Merci! |
Also having the same issue with multi lines |
+1 |
I love HAML, but this is killing me. |
In case someone else comes through here having this trouble with the Karma preprocessor, I wrote another preprocessor that will concatenate your multi-line attributes so that at least within the Karma environment, you can continue to use the much much faster https://www.npmjs.com/package/karma-haml-attribute-concatenation-preprocessor |
I'm having the same issue with multiline attributes migrating a HAML webapp out of Rails and unto Gulp. This is intolerable. Has this issue seriously been open for the past 4 years?! |
@AnalyzePlatypus I came back to take a look, but on inspection I'd call this unfixable. haml-js is parsing documents using regexes. The core of tag matching is done by https://github.com/creationix/haml-js/blob/master/lib/haml.js#L184 which assumes that each tag exists on a single line. Although it might be possible to match based on tag delimeters |
@Sinetheta: Agreed.
// If we reach the end of the line, then there is a problem
if (i > l) {
throw "Malformed attribute block";
} Maybe a more specific error, like: "Multiline tags unsupported" should be thrown instead. |
I guess best is to convert all haml files back to good old html! great... |
Ah wait, for those like me wanting to use webpack and having this error, you can use ruby-haml-loader which uses the actual |
For example, this gives a "malformed attribute block" error:
However, it works fine in Ruby Haml.
This also needs to be supported for curly-braced attribute blocks; Ruby Haml supports those being multiline as well, though it strictly enforces that each line but the last must end with a comma.
The text was updated successfully, but these errors were encountered: