I use HAML in my rails project for my html templates. I would like to figure out if its possible to divide a very long line and make it a couple of rows:
%a.
Sometimes Multiline in HAML can have little to nothing to do with adding rails code, since some elements need to have lots of attributes, such as the Bootstrap Progress Bar, and simply look hideous on one line.
This was giving me a headache:
.progress
.progress-bar.progress-bar-striped.progress-bar-success{ |
role: "progressbar", |
aria: { |
valuenow: "#{@percent}", |
valuemin: "0", |
valuemax: "100", |
}, |
style: "width: #{@percent}%;" } |
= "#{@percent}%"
And here was the solution to my struggle:
.progress
.progress-bar { class: "progress-bar-striped progress-bar-success",
role: "progressbar",
aria: { valuenow: "#{@percent}",
valuemin: "0",
valuemax: "100",
},
style: "width: #{@percent}%;" }
= "#{@percent}%"
Please note that even without the pipebar lines, so long as the preceding line ended in a comma, and no line ended with an open bracket,