Language extension for html5 data attributes

38 views
Skip to first unread message

Priit

unread,
Dec 19, 2012, 5:14:14 AM12/19/12
to ha...@googlegroups.com
Hi!

I'm using haml since 2007 and love it, great work!

Currently we are doing html5 jqurey mobile development and would like to simplify data syntax for haml.

Current syntax:
%div{:data => {:role => 'header', :theme => 'b'}}

I suggest:
.d-role-header.d-theme-b

Where 'd-' will indicate it's actually data attribute, second part will  be the hash key (example: role, theme etc) and last parts will be values (examlpe: header, b etc).

I made quick demo implementation: https://github.com/priit/haml/commit/9551419dba759c587380ec221504ae2745baf57f

We are using it with two projects and my coworkers love it so far.

I would love to go further, should haml community accept this custom data behavior into haml language (that would be great!) or should I go with separate extension as gem direction instead?

What do you think about it?

Thanks for any feedback!

Cheers,
Priit

Artem Komarov

unread,
Dec 19, 2012, 1:57:54 PM12/19/12
to ha...@googlegroups.com
I like the idea to shortcur the data attributes, but I think "d-" syntax is a little bit confusing it would be great to have something more explicit. Maybe involve a special character, or something.



--
You received this message because you are subscribed to the Google Groups "Haml" group.
To view this discussion on the web visit https://groups.google.com/d/msg/haml/-/jJNDJChdqDsJ.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to haml+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.



--
Regards,
Artem Komarov
Reply all
Reply to author
Forward
0 new messages