I was evaluating Slim as a replacement for HAML in a personal project, and it doesn't appear to handle HTML5 data attributes as gracefully as HAML. I was hoping someone may have also run into this, or may have known about an option/syntax I haven't yet found in their docs.
HAML allows you to define HTML 5 data attributes simply by using nested hashes like so:
%a{data: {key1: 'val', key2: 'val'}}
resulting in
<a data-key1='val' data-key2='val'></a>
Use the splat operator:
I prefer this kind to fix...
It is working for me
There are multiple ways in Slim
As Hash
Use it directly as "mu is too short" mentioned, quite intuitive.
Use Ruby code. I often do this and rarely above.
Will produce