Skip to content

Commit

Permalink
Created a README and set up rdoc
Browse files Browse the repository at this point in the history
git-svn-id: svn://hamptoncatlin.com/haml/trunk@26 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information
packagethief committed Sep 10, 2006
1 parent cf68e5a commit 82ff534
Showing 1 changed file with 78 additions and 3 deletions.
81 changes: 78 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,79 @@
Haml
====
= HAML (XHTML Abstraction Markup Language)

Description goes here
HAML 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.

== Features

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

== Using HAML as a Rails plugin

Write Rails templates with the .haml extension. Example:

%html
%head
%title= "Teen Wolf (1985)"
%body
#contents
%h1 "A highschooler discovers that he is a werewolf"
%ul.cast
%li "Scott Howard"
%li "Rupert 'Stiles' Stilinski"
%li "Lisa 'Boof' Marconi"
%li "Lewis"

Would result in this XHTML:

<html>
<head>
<title>Teen Wolf (1985)</title>
</head>
<body>
<div id="contents">
<h1>A highschooler discovers that he is a werewolf</h1>
<ul class="cast">
<li>Scott Howard</li>
<li>Rupert 'Stiles' Stilinski</li>
<li>Lisa 'Boof' Marconi</li>
<li>Lewis</li>
</ul>
</div>
</body>
</html>

You can access instance variables in HAML templates the same way you do in ERb templates.

file: app/controllers/movies_controller.rb

class MoviesController < ApplicationController
def index
@title = "Teen Wolf"
end
end

file: app/views/movies/index.haml

#content
.title
%h1= @title

Would produce the following HTML:

<div id="content">
<div class="title">
<h1>Teen Wolf</h1>
</div>
</div>



---
Copyright (c) 2006 Hampton Catlin

0 comments on commit 82ff534

Please sign in to comment.