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:
parent
84b9efe0bd
commit
4c5812fd36
1 changed files with 10 additions and 0 deletions
10
REFERENCE.md
10
REFERENCE.md
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue