4

How do I do this in HAML when i have HTML 5 Data attributes without value

<p class="title" data-section-title><a href="#mypanel">Panel</a></p>

I have done this, but HAML raises an error

%p{ class: "title", data: { section: {:title}}}= link_to "Panel", "#mypanel"

Thanks

4

1 回答 1

10

我刚刚为我正在做的一个项目写完这篇文章。我在基础文档中找不到它。

.large-12.columns
.section-container.auto{:data => {'section' => true}} 
    %section
        %p.title{:data => {'section-title' => true}} 
            %a{:href=>"#panel1" } Section 1
        .content{:data => {'section-content' => true}}  
            %p Content of section 1
    %section
        %p.title{:data => {'section-title' => true}}
            %a{:href=>"#panel2" } Section 2
        .content{:data => {'section-content' => true}}  
            %p Content of section 2
于 2013-07-29T08:06:55.950 回答