dir = File.dirname(__FILE__)
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
# = Haml (XHTML Abstraction Markup Language)
#
# Haml is a markup language
# that's 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 as PHP, RHTML, and ASP.
# However, Haml avoids the need for explicitly coding XHTML into the template,
# because it is actually an abstract description of the XHTML,
# with some code to generate dynamic content.
#
# == Features
#
# * Whitespace active
# * Well-formatted markup
# * DRY
# * Follows CSS conventions
# * Interpolates Ruby code
# * Implements Rails templates with the .haml extension
#
#
# == Characters with meaning to Haml
#
# Various characters, when placed at a certain point in a line,
# instruct Haml to render different types of things.
#
# === XHTML Tags
#
# These characters render XHTML tags.
#
# ==== %
#
#
# This element is placed at the beginning of a line.
# It's followed immediately by the name of an element,
# then optionally by modifiers (see below), a space,
# and text to be rendered inside the element.
# It creates an element in the form of
The magical fruit
#hello
#Sign my guestbook
# # # # You can also specify the version and type of XHTML after the !!!. # XHTML 1.0 Strict, Transitional, and Frameset and XHTML 1.1 are supported. # The default version is 1.0 and the default type is Transitional. # For example: # # !!! 1.1 # # is compiled to: # # # # and # # !!! Strict # # is compiled to: # # # # If you're not using the UTF-8 characterset for your document, # you can specify which encoding should appear # in the XML prolog in a similar way. # For example: # # !!! XML iso-8859-1 # # is compiled to: # # # # ==== / # # The forward slash character, when placed at the beginning of a line, # wraps all text after it in an HTML comment. # For example: # # %billabong # / This is the billabong element # I like billabongs! # # is compiled to: # ##
Hello, World
# # # Haml has the following filters defined: # # [plain] Does not parse the filtered text. # # [ruby] Parses the filtered text with the normal Ruby interpreter. # All output sent to $stdout, like with +puts+, # is output into the Haml document. # Not available if the suppress_eval option is set to true. # # [erb] Parses the filtered text with ERB, like an RHTML template. # Not available if the suppress_eval option is set to true. # At the moment, this doesn't support access to variables # defined by Ruby on Rails or Haml code. # # [sass] Parses the filtered text with Sass to produce CSS output. # # [redcloth] Parses the filtered text with RedCloth (http://whytheluckystiff.net/ruby/redcloth), # which uses both Textile and Markdown syntax. # Only works if RedCloth is installed. # # [textile] Parses the filtered text with Textile (http://www.textism.com/tools/textile). # Only works if RedCloth is installed. # # [markdown] Parses the filtered text with Markdown (http://daringfireball.net/projects/markdown). # Only works if RedCloth or BlueCloth (http://www.deveiate.org/projects/BlueCloth) # is installed # (BlueCloth takes precedence if both are installed). # # You can also define your own filters (see Setting Options, below). # # === Ruby evaluators # # ==== = # # The equals character is followed by Ruby code, # which is evaluated and the output inserted into the document as plain text. # For example: # # %p # = ['hi', 'there', 'reader!'].join " " # = "yo" # # is compiled to: # ## hi there reader! # yo #
# # ==== ~ # # The tilde character works the same as the equals character, # but the output is modified in such a way # that newlines in whitespace-sensitive elements work properly. # For example: # # %foo # = "Woahthis is \ncrazy" # %foo2 # ~ "Woah
this is \ncrazy" # # is compiled to: # #
this is #crazy #
this iscrazy #
# /^^^\ |[] []| |_____| ##
# hello there you! #
# # ===== Blocks # # Ruby blocks, like XHTML tags, don't need to be explicitly closed in Haml. # Rather, they're automatically closed, based on indentation. # A block begins whenever the indentation is increased # after a silent script command. # It ends when the indentation decreases # (as long as it's not an +else+ clause or something similar). # For example: # # - (42...47).each do |i| # %p= i # %p See, I can count! # # is compiled to: # ## 42 #
## 43 #
## 44 #
## 45 #
## 46 #
# # Another example: # # %p # - case 2 # - when 1 # = "1!" # - when 2 # = "2?" # - when 3 # = "3." # # is compiled to: # ## 2? #
# # == Using Haml as a Rails plugin # # Write Rails templates with the .haml extension. # For example: # # # file: app/views/movies/teen_wolf.haml # # %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" # # is compiled to: # # # #