HAML.jl icon indicating copy to clipboard operation
HAML.jl copied to clipboard

Support value-less attributes

Open tkluck opened this issue 5 years ago • 3 comments

As reported by @mlhetland in #6. They suggest attr=nothing as a possible way of expressing this, but I'm not sure that's very intuitive as other empty values (e.g. []) mean that the attribute should not be rendered at all. Suggestions welcome.

tkluck avatar Apr 26 '20 17:04 tkluck

Well, if you don’t rely directly on named tuple syntax, you could simply permit valueless keys directly in HAML. (How it’s implemented behind the scenes is then less important; you could use some other sentinel than nothing – one internal to HAML.jl?)

mlhetland avatar Apr 26 '20 17:04 mlhetland

Also: It doesn’t seem like a general, intuitive “emptiness” is predictive of being hidden , as using an empty string still renders the attribute (with an empty value).

mlhetland avatar Apr 26 '20 17:04 mlhetland

I like your first suggestion: just support it at a syntax level like

%script(defer)

which doesn't seem to conflict with anything else. Internally, after parsing, it makes sense to use some sentinel singleton as you say.

tkluck avatar Apr 26 '20 17:04 tkluck