1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Document recursive nature of hash attr expansion

This commit is contained in:
Matt Wildig 2014-02-14 23:16:55 +00:00
parent 84b9efe0bd
commit 4c5812fd36

View file

@ -419,6 +419,16 @@ and the output will be rendered as:
<a data-author_id='123' data-category='7' href='/posts'>Posts By Author</a>
This expansion of hashes is recursive any value of the child hash that is
itself a hash will create an attribute for each entry, with the attribute name
prefixed with all ancestor keys. For example:
.book-info{:data => {:book => {:id => 123, :genre => 'programming'}, :category => 7}}
will render as:
<div class='book-info' data-book-genre='programming' data-book-id='123' data-category='7'></div>
### Class and ID: `.` and `#`
The period and pound sign are borrowed from CSS. They are used as shortcuts to