Jump to content

Haml

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Hcatlin (talk | contribs) at 00:30, 6 August 2006 (Initial Create before the conference). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:HAML

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 inline code. HAML functions as a replacement for inline page templating systems such PHP, RHTML, and ASP. However, HAML avoids the need for explicitly coding XHTML into the template, because it iself is a description of the XHTML, with some code to generate dynamic content.

Characteristics

  • Whitespace Active
  • Well-formatted XHTML
  • DRY
  • Follows styles common in CSS

Disadvantages

HAML can be significantly slower than other templating engines, since more information must be generated by the software during render.

Example

Note: This is a simple preview example and in may not reflect the final version of the language.

%html

 %head
   %title= "Funky Monkey"
 %body
   .contents
     %p= @variable_of_first_words

Would result in this XHTML.

<html>

 <head>
   <title>Funky Monkey</title>
 </head>
 <body>
     Hello, World!
 </body>

</html>


Implementations

The only current implementation of HAML has been built for Ruby on Rails, however the language itself could be extended for any other framework or language. The actual specifications for the implementation will be revealed at RailsConf Europe 2006 on September 14-15th, 2006.

Current Usage

HAML is currently being used in several open source projects including How'd They Vote and Contentopolis.

See also