sass n : an impudent or insolent rejoinder; "don't give me any of your sass" [syn: sassing, backtalk, back talk, lip, mouth] v : answer back in an impudent or insolent manner; "don't sass me!"; "The teacher punished the students who were sassing all morning";
- a UK /sæs/, /s
Haml (XHTML Abstraction Markup Language) is a markup language that is used to cleanly and simply describe the XHTML of any web document without the use of traditional inline coding. It’s designed to address many of the flaws in traditional templating engines, as well as making markup as elegant as it can be. Haml functions as a replacement for inline page templating systems such as PHP, RHTML, and ASP. However, Haml avoids the need for explicitly coding XHTML into the template, because it is itself a description of the XHTML, with some code to generate dynamic content.
Principles: Markup should not be used merely as a tool to get browsers to render a page the way its author wants it rendered. The rendering isn't the only thing people have to see; they have to see, modify, and understand the markup as well. Thus, the markup should be just as user-friendly and pleasant as the rendered result.: XHTML involves major repetition. Every element is named twice: once before its content and once after. ERB adds even more repetition and unnecessary characters. Haml avoids all of this by relying on indentation, not text, to determine where elements and blocks of code begin and end. Not only does this result in smaller templates, it makes the code much cleaner to look at.: One of the major problems with traditional templating languages is that not only do they not encourage well-indented code, they actively make it challenging, or even impossible, to write. The result is confusing, unreadable XHTML. Haml formats tags so they are well indented and reflect the underlying structure of the document.: XML and XHTML are formats built upon the idea of a structured document. That structure is reflected in their markup, and it should likewise be reflected in meta-markup such as Haml. Because Haml's logic is based on indentation of child elements, this structure is naturally preserved, making the document much easier and more logical for mere humans to read.
- Haml is "whitespace active", which requires 2 spaces for each indent level, requires that text editors are properly configured to use the tab key.
- In order to have inline tags, for example to end a sentence with a link (and specifically to avoid whitespace before the period), currently you have to write the normal HTML tag inline, or use the succeed/precede helper methods. This is because parsing of the content that follows after tag definitions is something that is currently being avoided because of the performance penalty involved.
- There are no WYSIWYG Haml editors, whereas there are many XHTML and HTML editors. However, the growing community of Haml users has released syntax bundle addons to many popular programming IDEs, such as Eclipse (which includes the spinoff IDEs RadRails and Aptana), jEdit, NetBeans, and editors like TextMate and vim. This allows developers to edit Haml in an environment that is aware of the indenting rules and syntax.
ExampleNote: This is a simple preview example and may not reflect the current version of the language.
!!! %html %head %title BoBlog %meta/ = stylesheet_link_tag 'main' %body #header %h1 BoBlog %h2 Bob's Blog #content - @entries.each do |entry| .entry %h3.title= entry.title %p.date= entry.posted.strftime("%A, %B %d, %Y") %p.body= entry.body #footer %p All content copyright © Bob
The above Haml would produce this XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
BoBlog BoBlog Bob's Blog Halloween Tuesday, October 31, 2006 Happy Halloween, glorious readers! I'm going to a party this evening... I'm very excited. New Rails Templating Engine Friday, August 11, 2006 There's a very cool new Templating Engine out for Ruby on Rails. It's called Haml. All content copyright © Bob
The official implementation of Haml has been built for Ruby with plugins for Ruby on Rails and Merb, but the Ruby implementation also functions independently.
There are also implementations in other languages:
Haml was invented in May 2006 by Hampton Catlin who continues to work on the implementation and the ideals behind Haml. However, Nathan Weizenbaum is responsible for much of the recent growth and maturation of the Haml codebase.
Haml is currently used on the following sites:
sass in Polish: Haml