Estou com problemas para converter a sintaxe HTML em HAML.
Eu conheço um <div>
A classe pode ser simplesmente representada por:
.class-name
Mas quero converter a seguinte sintaxe em HAML e também incorporar uma variável no título:
<div title="My title" class="my-text">This is my title</div>
Algo como:
.title{@ruby-variable}.my-text
Respostas:
1 para resposta № 1.my-text{:title => "My title"} This is my title
no haml você usa #someid.someclass{:custom_attr => "something"}
. :costum_attr
também pode ser uma classe ou um ID, se você precisar defini-lo dinamicamente.
1 para resposta № 2
Tente isto:
.my-text{:title => "My title"} This is my title
Ou outra sintaxe:
.my-text(title = "My title") This is my title