Haml: Haml 5.2 and 6

Created on 2 Oct 2020  ·  6Comments  ·  Source: haml/haml

This release is meant to be the final release that's got all the bells and whistles of Haml from the last 10 years. Going forward, new releases will be in the 6.x.x series and will NOT be backwards compatible for many features.

I was curious to find out what that meant in real terms but I couldn't find a place where this was discussed. Looking at the haml website, the mailing list has been unused for 3+ years, the blog hasn't been updated since haml 4.

I'm starting a new project and "the next version of haml won't have all the features it currently has" without any mention of what that means is scary.

Feature

Most helpful comment

Yeah, at this point, I'm trying to revive a pretty-dead project solo. Haven't really setup any discussion areas and would definitely be willing to. The google group is definitely long-gone.

There are several things I KNOW we want to add in Haml-6.

1) Multi-line support for attributes. data-* attributes seem here to stay and it's very easy to make a super long single line of Haml for one tag that just... is ugly.
2) Unicode character support

Things we might want to add:
1) Support attributes with - in them like %div{data-value: 6} which is an invalid Ruby hash, but should damn well be supported by Haml. And this is a good example of where it's not "backward compatible"... Ruby would think that you are trying to call data.-(value) instead of assuming it's a key. It's _possible_ someone has that in their code... I just don't know. Or we should go the other way and say "JSON-like only" and require quotes for everything.
2) Alternative to %, as that was originally chosen to be the furtherest character away from your fingers on US-keyboards, requiring a stretching of the hand to press. It was part of encouraging the use of classes and ids, but this fad has long since passed– so is it really fair to discourage HTML5 elements?

Also, about half the codebase is dealing with Action View integration points that have changed a LOT over the years and so there is a ton of code to try and support that integration. I just don't think it makes sense for a language repo to have so much code around a single integration. It's my _opinion_ that if we just looked at it and only supported Rails 6+, that we could massively simplify what we're doing.

Honestly, I don't have any specific things that I'm planning on not supporting, but I just have a feeling that we're going to run into more edge cases that are going to be nearly impossible to support with a multi-line syntax.

And to be clear, I'm making these changes because I'm using Haml in a whole new startup with a team at @veuelive and a growing codebase, and it's clear where Haml isn't staying up-to-snuff.

All 6 comments

Yeah, at this point, I'm trying to revive a pretty-dead project solo. Haven't really setup any discussion areas and would definitely be willing to. The google group is definitely long-gone.

There are several things I KNOW we want to add in Haml-6.

1) Multi-line support for attributes. data-* attributes seem here to stay and it's very easy to make a super long single line of Haml for one tag that just... is ugly.
2) Unicode character support

Things we might want to add:
1) Support attributes with - in them like %div{data-value: 6} which is an invalid Ruby hash, but should damn well be supported by Haml. And this is a good example of where it's not "backward compatible"... Ruby would think that you are trying to call data.-(value) instead of assuming it's a key. It's _possible_ someone has that in their code... I just don't know. Or we should go the other way and say "JSON-like only" and require quotes for everything.
2) Alternative to %, as that was originally chosen to be the furtherest character away from your fingers on US-keyboards, requiring a stretching of the hand to press. It was part of encouraging the use of classes and ids, but this fad has long since passed– so is it really fair to discourage HTML5 elements?

Also, about half the codebase is dealing with Action View integration points that have changed a LOT over the years and so there is a ton of code to try and support that integration. I just don't think it makes sense for a language repo to have so much code around a single integration. It's my _opinion_ that if we just looked at it and only supported Rails 6+, that we could massively simplify what we're doing.

Honestly, I don't have any specific things that I'm planning on not supporting, but I just have a feeling that we're going to run into more edge cases that are going to be nearly impossible to support with a multi-line syntax.

And to be clear, I'm making these changes because I'm using Haml in a whole new startup with a team at @veuelive and a growing codebase, and it's clear where Haml isn't staying up-to-snuff.

Just to add on a bit more about haml-spec. Haml-spec was a fantastic movement to try and unify the many offspring implementations of Haml's in a ton of languages. It codified the Lua, Python, and Perl implementations about markup that is non-ruby-focused.

However, the downside of this is that Perl/Lua implementations are abandoned and the Python one gets small compatibility updates every ~2 years.

This has meant that the language itself has ossified in an attempt to get disperate parsers+interpreters to have some kind of standardization.

When I originally designed Haml, one of the design goals was to make it "Ruby-like" and sort of natively inhabit a space between Ruby, CSS, and Semantic HTML. I certainly wasn't thinking of the language as a competitor to Markdown or some other simple, highly portable markup language. And yet, efforts like haml-spec do sort of have an underlying assumption that Haml as a language, is highly portable.

I don't regret making content after - or = at the end of a line mean "interpret this as the local language", but I do regret leaning so heavily on Ruby hashes to allow us to deal with attributes. It ties the languages together very, very closely.

As you can tell, this isn't yet a plan, but it's a lot of things I'm considering with what to do best to help get Haml back into shape for 2021+.

Thanks, that gives me a lot more context.

Appreciate your efforts.

For more context, here is my current Gist that includes my ideas for Haml 6.

https://gist.github.com/hcatlin/6c5d24d27897b9fa0888a012b612e824

To note... ability to chop-down attributes and the use of & to make a BEM-style parent appender.... in the sample, &__primary turns into .content-area__primary

I'm also using HAML at a new startup and still find it to be an excellent companion to the Rails app. We use utility-based CSS (Tailwind) and which pairs well with HAML since there ends up being a fair amount of class names and nesting. Let us know if we can pitch in on anything.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atomAltera picture atomAltera  ·  7Comments

kamen-hursev picture kamen-hursev  ·  6Comments

dewski picture dewski  ·  8Comments

yb66 picture yb66  ·  4Comments

kyletolle picture kyletolle  ·  6Comments