Haml

Haml code posted
created at 25 Oct 07:23, updated at 25 Oct 07:25

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-# encoding: utf-8
%article#haml.slide
  %h1 Haml
  %h2 Core principles
  %ul
    %li
      %header Markup Should be Beautiful
      %p Markup should not be used merely as a tool to get browsers to render a page how the 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.
    %li
      %header Markup Should be DRY
      %p HTML 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.
    %li
      %header Markup Should be Well-Indented
      %p One of the major problems with ERB is that not only does it not encourage well-indented code, it actively makes it challenging, or even impossible, to write. This leads to confusing, unreadable HTML, when it should be well indented and reflecting the underlying structure of the document. Haml automatically properly formats all tags to that it does.
    %li
      %header HTML Structure Should be Clear
      %p XML and HTML 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.
  %footnote
    %a{:href => "http://haml.info/about.html"}
      Haml about
1.76 KB in 2 ms with coderay