Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HAML - how do I create this line of HTML

Tags:

haml

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!

like image 913
GeekedOut Avatar asked Apr 25 '12 18:04

GeekedOut


People also ask

How do you write Haml in HTML?

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.

What is a HTML Haml file?

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 Haml in CSS?

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.


1 Answers

%a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}

OR Else

%a.btn.btn-navbar{:data => {:toggle => 'collapse', :target => '.nav-collapse'}}
like image 96
Chandrakant Avatar answered Oct 08 '22 22:10

Chandrakant