0
@@ -2,18 +2,18 @@ dir = File.dirname(__FILE__)
0
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# = Haml (XHTML Abstraction Markup Language)
0
# Haml is a markup language
0
# that's used to cleanly and simply describe the XHTML of any web document,
0
# without the use of inline code.
0
# Haml functions as a replacement
0
-# for inline page templating systems such as PHP, ERB, and ASP.
0
-# However, Haml avoids the need for explicitly coding XHTML into the template,
0
+# for inline page templating systems such as PHP, ERB, and ASP.
0
+# However, Haml avoids the need for explicitly coding XHTML into the template,
0
# because it is actually an abstract description of the XHTML,
0
# with some code to generate dynamic content.
0
# * Well-formatted markup
0
@@ -36,9 +36,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# To enable it as a Rails plugin,
0
# haml --rails path/to/rails/app
0
# Haml is enabled in Merb by default,
0
# so Merb users don't have to do anything more.
0
@@ -50,24 +50,24 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# the same way you do in ERb templates.
0
# Helper methods are also available in Haml templates.
0
# For example (this example uses Rails, but the principle for Merb is the same):
0
# # file: app/controllers/movies_controller.rb
0
# class MoviesController < ApplicationController
0
# -# file: app/views/movies/index.haml
0
# = link_to 'Home', home_url
0
@@ -89,41 +89,41 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# engine.render #=> "<p>Haml code!</p>\n"
0
# == Characters with meaning to Haml
0
# Various characters, when placed at a certain point in a line,
0
# instruct Haml to render different types of things.
0
# These characters render XHTML tags.
0
# The percent character is placed at the beginning of a line.
0
# It's followed immediately by the name of an element,
0
# then optionally by modifiers (see below), a space,
0
# and text to be rendered inside the element.
0
# It creates an element in the form of <tt><element></element></tt>.
0
# <three>Hey there</three>
0
# Any string is a valid element name;
0
# Haml will automatically generate opening and closing tags for any element.
0
# Brackets represent a Ruby hash
0
# that is used for specifying the attributes of an element.
0
# It is literally evaluated as a Ruby hash,
0
@@ -132,13 +132,13 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# will be replaced by appropriate escape sequences.
0
# The hash is placed after the tag is defined.
0
# %head{ :name => "doc_head" }
0
# %script{ 'type' => "text/" + "javascript",
0
# :src => "javascripts/script_#{2 + 7}" }
0
# <head name="doc_head">
0
# <script src='javascripts/script_9' type='text/javascript'>
0
@@ -200,7 +200,7 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# In XHTML, the only valid value for these attributes is the name of the attribute.
0
# Thus this will render in XHTML as
0
# <input selected="selected">
0
# To set these attributes to false, simply assign them to a Ruby false value.
0
@@ -211,9 +211,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# Square brackets follow a tag definition and contain a Ruby object
0
# that is used to set the class and id of that tag.
0
# The class is set to the object's class
0
@@ -222,40 +222,40 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# Because the id of an object is normally an obscure implementation detail,
0
# this is most useful for elements that represent instances of Models.
0
# # file: app/controllers/users_controller.rb
0
# @user = CrazyUser.find(15)
0
# -# file: app/views/users/show.haml
0
# <div class="crazy_user" id="crazy_user_15">
0
# <bar class="fixnum" id="fixnum_581" />
0
# This is based off of DHH's SimplyHelpful syntax,
0
# as presented at RailsConf Europe 2006.
0
# The forward slash character, when placed at the end of a tag definition,
0
# causes the tag to be self-closed.
0
# %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
0
# <meta http-equiv='Content-Type' content='text/html' />
0
@@ -271,9 +271,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# <meta http-equiv='Content-Type' content='text/html' />
0
# The period and pound sign are borrowed from CSS.
0
# They are used as shortcuts to specify the <tt>class</tt>
0
# and <tt>id</tt> attributes of an element, respectively.
0
@@ -281,22 +281,22 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# by chaining the class names together with periods.
0
# They are placed immediately after the tag and before an attributes hash.
0
# %span#rice Chicken Fried
0
# %p.beans{ :food => 'true' } The magical fruit
0
# %h1.class.otherclass#id La La La
0
# <span id='rice'>Chicken Fried</span>
0
# <p class='beans' food='true'>The magical fruit</p>
0
# <h1 class='class otherclass' id='id'>La La La</h1>
0
@@ -305,9 +305,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# Neil Patrick Harris would like to dispel any rumors that he is straight
0
# <div class="articles">
0
# <div class="article title">Doogie Howser Comes Out</div>
0
@@ -317,34 +317,34 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# ==== Implicit Div Elements
0
# Because the div element is used so often, it is the default element.
0
# If you only define a class and/or id using the <tt>.</tt> or <tt>#</tt> syntax,
0
# a div element is automatically used.
0
# .description What a cool item!
0
# %div{:id => collection}
0
# %div{:class => 'item'}
0
# %div{:class => 'description'} What a cool item!
0
# <div id='collection'>
0
# <div class='description'>What a cool item!</div>
0
# <tt>=</tt> is placed at the end of a tag definition,
0
# after class, id, and attribute declarations.
0
# It's just a shortcut for inserting Ruby code into an element.
0
@@ -353,45 +353,45 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# However, if the result is short enough,
0
# it is displayed entirely on one line.
0
# is not quite the same as:
0
# ==== No Special Character
0
# If no special character appears at the beginning of a line,
0
# the line is rendered as plain text.
0
# When describing XHTML documents with Haml,
0
# you can have a document type or XML prolog generated automatically
0
# by including the characters <tt>!!!</tt>.
0
@@ -400,9 +400,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# %h1 I am the international space station
0
# <?xml version="1.0" encoding="utf-8" ?>
0
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
@@ -414,112 +414,112 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
# <p>Sign my guestbook</p>
0
# You can also specify the version and type of XHTML after the <tt>!!!</tt>.
0
# XHTML 1.0 Strict, Transitional, and Frameset and XHTML 1.1 are supported.
0
# The default version is 1.0 and the default type is Transitional.
0
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
0
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0
# If you're not using the UTF-8 character set for your document,
0
# you can specify which encoding should appear
0
# in the XML prolog in a similar way.
0
# <?xml version="1.0" encoding="iso-8859-1" ?>
0
# The forward slash character, when placed at the beginning of a line,
0
# wraps all text after it in an HTML comment.
0
# / This is the peanutbutterjelly element
0
# <!-- This is the peanutbutterjelly element -->
0
# The forward slash can also wrap indented sections of code. For example:
0
# %p This doesn't render...
0
# %h1 Because it's commented out!