This is kind of a complicated line of HTML to create in HAML:
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
I am not sure how to do that. Any idea? I am only able to do this:
%a.btn
%span.icon-bar Hello
but not sure how to do the complex stuff.
Thanks!
In Haml, we write a tag by using the percent sign and then the name of the tag. This works for %strong , %div , %body , %html ; any tag you want. Then, after the name of the tag is = , which tells Haml to evaluate Ruby code to the right and then print out the return value as the contents of the tag.
Haml (HTML Abstraction Markup Language) Haml is a markup language that's used to cleanly and simply describe the HTML of any web document, without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ERB, and ASP.
What is it? Haml (HTML abstraction markup language) is based on one primary principle: markup should be beautiful. It's not just beauty for beauty's sake either; Haml accelerates and simplifies template creation down to veritable haiku.
%a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}
OR Else
%a.btn.btn-navbar{:data => {:toggle => 'collapse', :target => '.nav-collapse'}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With