Questions tagged [haml]

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. It can be used as a standalone HTML generation tool or as a template rendering engine in a web framework such as Ruby on Rails or Ramaze. HAML templates are pre-compiled into plain HTML templates which is consumed by a client's web browser to render information sent by the server as a HTML web page.

HAML (HTML Abstraction Markup Language) is an indentation based, terse page description markup. It features among other things autoclosing of tags and convenient shorthands to set class and id attributes.


Example

page and its conversion :

erb

<div id='content'>
  <div class='left column'>
    <h2>Welcome to our site!</h2>
    <p><%= print_information %></p>
  </div>
  <div class="right column">
    <%= render :partial => "sidebar" %>
  </div>
</div>

HAML

#content
  .left.column
    %h2 Welcome to our site!
    %p= print_information
  .right.column
    = render :partial => "sidebar"

Where to start:

  1. Getting Started Tutorial

  2. Html2haml converter

3540 questions
1
vote
2 answers

Rails Masonry GEM issues with Bootstrap Tab-pane

I'm using the bootstrap tab-pane inside of my rails application. Inside of each tab I want to use the Masonry GEM. However, all the items are stacking on top of eachother. .container %ul.nav.nav-tabs - if @project.user == current_user …
jxdx
  • 25
  • 1
  • 5
1
vote
1 answer

html_safe on whole html code block in rails

i can't seem to find a way to escape whole html block, if it is even possible. Here is what i am trying to do: %table %tr %th{rowspan: "2"}= t("public.home.graphic_title_payment").html_safe %th.datefield{rowspan: "2"}=…
user2945241
  • 360
  • 5
  • 19
1
vote
1 answer

The right way to use hyphenated attributes in haml.js

For attributes like in Ruby haml: I would use %meta{:'http-equiv' => 'X-UA-Compatible'} it's not elegant, but works fine today I'm using haml.js it reports a a error any idea?
mko
  • 21,334
  • 49
  • 130
  • 191
1
vote
1 answer

Rails + Haml: Returning from a partial will somehow remove the form tag

This is lengthy, yes, I apologize. But I want to be clear because this issue is so odd. I have a terms of service modal that comes up whenever a user has not accepted our terms of service (TOS). For the purposes here, javascript is turned off and…
ynkr
  • 25,946
  • 4
  • 32
  • 30
1
vote
1 answer

Difference between Markdown and Haml?

I am a web designer trying to improve... These last few days I had decided to study Haml and SCSS and other things, but I just discovered Markdown and now I don't understand the difference between Markdown and Haml. Do they serve the same purpose?…
CandyKillah
  • 27
  • 1
  • 6
1
vote
0 answers

Middleman and Sinatra Contact Form rendering template

I'm trying to create a middleman site with a contact form using sinatra and pony gem I'm having problems getting middleman and sinatra to play nicely together THE ISSUE: " My Contact From is not rendering my header and footer and also does not…
user1502223
  • 645
  • 2
  • 10
  • 27
1
vote
1 answer

HAML / Ruby - Code Helper Blocks

I create something like this Which produces a partial - creates the code elements and renders the code partial I would like to wrap this all into one tidy element - ie calling the code partial will automatically render the partials inside the code…
Ian Warner
  • 1,058
  • 13
  • 32
1
vote
1 answer

Bootstrap 3 seems to justify table columns differently depending on the size of the field

I have a simple table styled with bootstrap but for some reason it will use different justify depending on how long the fields are. There seems to be 2 different settings. If the line data is short, it will left justify right next to the first…
JCC
  • 453
  • 7
  • 20
1
vote
1 answer

Ruby on Rails 4 Haml inline link_to interpolated external website url

I have a Rails 4 project where I'm trying to display relevant information about the host of an event. I'm writing in Haml instead of ERB. I want to render a string describing the type of information about the host, followed by the information. For…
BillFienberg
  • 879
  • 11
  • 17
1
vote
3 answers

loop not work in haml, but work in html.erb

It's very annoying, Show nothing - calendar @date do |date| = date.day But output of haml is in my expectation <%= calendar @date do |date| %> <%= date.day %> <% end %> This is my helper source code. module CalendarHelper require…
newBike
  • 14,385
  • 29
  • 109
  • 192
1
vote
1 answer

HAML and ERB rendering problems

I've written a RoR app and trying to deploy it. So, the following problem shows up on my Linode: Browser page shows just the code I wrote in index.html.haml not a page as supposed. When I try to use index.html instead I get a valid rendered…
Maria
  • 79
  • 7
1
vote
3 answers

Including partial template

In sinatra's app, require 'rubygems' require 'sinatra' require 'haml' get '/new' do haml :new end get '/edit' do haml :edit end __END__ @@ layout %html %head %title %body = yield @@ _form # partial form @@ new %h1 Add a new…
abernier
  • 27,030
  • 20
  • 83
  • 114
1
vote
1 answer

Haml implement select multiple as in HTML

How in Haml can I create a select multiple tag like in HTML? Like the…
IcyBright
  • 654
  • 4
  • 15
1
vote
0 answers

javascript - changing a bootstrap collapsable's id and target

I have a pannel which will have data in it for a form in rails #accordion.panel-group #panel1.panel.panel-default .panel-heading %h4.panel-title %a{"data-target" => "#collapseOne", "data-toggle" => "collapse",…
1
vote
2 answers

How to add a class to the form_for helper in a Rails 4 app?

I'm using bootstrap CCS to style my Rails 4 app, but cannot figure out how to add a class to the form when using the form_for helper. I have followed the suggestions on several other threads without success. Two such threads... How do you override…
user1936583
1 2 3
99
100