public
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/nex3/haml.git
Moving around stuff.



git-svn-id: svn://hamptoncatlin.com/haml/tags/trunk@78 
7063305b-7217-0410-af8c-cdc13e5119b9
hcatlin (author)
Sat Oct 14 15:44:46 -0700 2006
commit  6fdffe1d7888e3db9b7d0dae67420ac17f94334f
tree    83bf3f8c221a76df69f326bff29b886d032a96dc
parent  4266688e30051e9649bb491e9b248b2dbb8e35d3
0
...
22
23
24
 
 
 
25
26
27
...
50
51
52
53
54
55
56
 
 
 
 
 
 
 
 
 
 
 
 
 
57
58
59
60
61
62
 
63
64
65
66
67
68
69
70
71
72
73
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
76
 
 
 
 
77
78
79
80
81
82
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
85
86
87
88
 
 
89
90
91
92
93
 
94
95
 
96
97
98
 
99
 
 
100
101
102
103
 
 
 
 
104
105
106
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
109
110
111
112
113
114
 
 
 
 
 
115
116
 
117
118
 
119
120
121
...
139
140
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
143
144
145
146
 
 
147
148
149
...
176
177
178
179
180
181
182
 
183
184
 
185
186
187
...
189
190
191
192
 
193
194
195
196
197
198
199
 
200
201
202
...
206
207
208
209
210
211
212
213
...
22
23
24
25
26
27
28
29
30
...
53
54
55
 
 
 
 
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
71
72
 
73
74
75
76
77
 
78
79
80
81
82
 
 
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
 
134
135
136
137
138
 
139
 
 
 
 
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
 
 
172
173
174
175
176
177
 
178
179
 
180
181
182
183
184
185
186
187
188
 
 
 
189
190
191
192
193
 
 
 
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
 
 
 
 
226
227
228
229
230
231
 
232
233
 
234
235
236
237
...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
...
439
440
441
 
 
 
 
442
443
 
444
445
446
447
...
449
450
451
 
452
453
454
455
456
457
458
 
459
460
461
462
...
466
467
468
 
 
469
470
471
0
@@ -22,6 +22,9 @@ HAML was originally created by Hampton Catlin (hcatlin). Help with the
0
 Ruby On Rails implementation and much of the documentation by
0
 Jeff Hardy (packagethief).
0
 
0
+Nathan Weizenbaum (Nex3) contribued the buffered-engine code along with many
0
+other enhancements including the silent-line syntax ("-").
0
+
0
 If you use this software, you must pay Hampton a compliment. Say something
0
 nice about it. Beyond that, the implementation is licensed under the MIT
0
 License. Ok, fine, I guess that means compliments aren't *required*.
0
@@ -50,72 +53,185 @@ is compiled to:
0
   
0
 == Characters with meaning to Haml
0
 
0
-Haml responds to certain special characters. To create an element in the form of
0
-<tt><element></element></tt> use the <tt>%</tt> character, immediately followed
0
-by the element name. To specify attributes, include a hash of attributes inside
0
-curly braces. Example:
0
+Various characters, when placed at a certain point in a line, instruct HAML
0
+to render different types of things.
0
+
0
+=== XHTML Tags
0
+
0
+These characters render XHTML tags.
0
+
0
+==== %
0
+
0
+This element is placed at the beginning of a line. It's followed immediately
0
+by the name of an element, then optionally by modifiers (see below), a space,
0
+and text to be rendered inside the element. It creates an element in the form of
0
+<tt><element></element></tt>. For example:
0
 
0
   %one
0
- %meta{:content => 'something'}/
0
     %two
0
       %three Hey there
0
-
0
+
0
 is compiled to:
0
 
0
   <one>
0
     <two>
0
- <meta content='something' />
0
       <three>Hey there</three>
0
     </two>
0
   </one>
0
 
0
 Any string is a valid element name; Haml will automatically generate opening and
0
-closing tags for any element. When you want to force the output of a
0
-self-closing tag, use the forward slash character. Example:
0
+closing tags for any element.
0
+
0
+==== {}
0
+
0
+Brackets represent a Ruby hash that is used for specifying the attributes of an
0
+element. It is literally evaluated as a Ruby hash, so logic will work in it. At
0
+the moment, though, it doesn't see local variables. The hash is placed after
0
+the tag is defined. For example:
0
+
0
+ %head{ :name => "doc_head" }
0
+ %script{ 'type' => "text/" + "javascript", :src => "javascripts/script_#{2 + 7}" }
0
+
0
+is compiled to:
0
+
0
+ <head name="doc_head">
0
+ <script src='javascripts/script_9' type='text/javascript'>
0
+ </script>
0
+ </head>
0
+
0
+==== []
0
+
0
+Square brackets follow a tag definiton and contain a Ruby object that is used to
0
+set the class and id of that tag. The class is set to the object's class
0
+(transformed to use underlines rather than camel case), and the id is set to the
0
+object's class followed by its id. Because the id of an object is normally an
0
+obscure implementation detail, this is most useful for elements that represent
0
+instances of Models. For example:
0
+
0
+ # file: app/controllers/users_controller.rb
0
+
0
+ def show
0
+ @user = CrazyUser.find(15)
0
+ end
0
+
0
+ # file: app/views/users/show.haml
0
+
0
+ %div[@user]
0
+ %bar[290]/
0
+ Hello!
0
+
0
+is compiled to:
0
+
0
+ <div class="crazy_user" id="crazy_user_15">
0
+ <bar class="fixnum" id="fixnum_581" />
0
+ Hello!
0
+ </div>
0
+
0
+This is based off of DHH's SimplyHelpful syntax as presented at RailsConf Europe 2006.
0
+
0
+==== /
0
 
0
- %br/ # => <br />
0
+The forward slash character, when placed at the end of a tag definition, causes
0
+the tag to be self-closed. For example:
0
+
0
+ %br/
0
   %meta{:http-equiv => 'Content-Type', :content => 'text/html'}/
0
- # => <meta http-equiv='Content-Type' content='text/html' />
0
 
0
-HTML div elements are assumed when no <tt>%tag</tt> is present and the line is
0
-preceeded by either the <tt>#</tt> or the <tt>.</tt> characters. This convention
0
-uses familiar CSS semantics: <tt>#</tt> denotes the id of the element,
0
-<tt>.</tt> denotes its class name. Example:
0
+is compiled to:
0
+
0
+ <br />
0
+ <meta http-equiv='Content-Type' content='text/html' />
0
+
0
+==== . and #
0
+
0
+The period and pound sign are borrowed from CSS and used as shortcuts to specify the
0
+<tt>class</tt> and <tt>id</tt> attributes of an element, respectively. They are
0
+placed immediately after the tag, and before an attributes hash. For example:
0
+
0
+ div#things
0
+ %span#rice Chicken Fried
0
+ %p.beans{ :food => 'true' } The magical fruit
0
+ %h1.class#id La La La
0
+
0
+is compiled to:
0
+
0
+ <div id='things'>
0
+ <span id='rice'>Chicken Fried</span>
0
+ <p class='beans' food='true'>The magical fruit</p>
0
+ <h1 class='class' id='id'>La La La</h1>
0
+ </div>
0
+
0
+==== Assumed Divs
0
+
0
+Because the div element is used so often, it is the default element. If you only
0
+define a class and/or id using the <tt>.</tt> or <tt>#</tt> syntax, a div element
0
+is automatically used. For example:
0
 
0
   #collection
0
     .item
0
- Broken record album
0
-
0
+ .description What a cool item!
0
+
0
 is the same as:
0
 
0
   %div{:id => collection}
0
     %div{:class => 'item'}
0
- Broken record album
0
+ %div{:class => 'description'} What a cool item!
0
 
0
-and is comiled to:
0
+and is compiled to:
0
 
0
   <div id='collection'>
0
     <div class='item'>Broken record album</div>
0
+ <div class='description'>What a cool item!</div>
0
   </div>
0
+
0
+==== = and ~
0
 
0
-There is a shortcut when you want to specify either the id or class attributes
0
-of an element: follow the element name with either the <tt>#</tt> or the
0
-<tt>.</tt> characters. Example:
0
+<tt>=</tt> and <tt>~</tt> are placed at the end of a tag definition, after class,
0
+id, and attribute declarations. They're just shortcuts for inserting Ruby code
0
+into an element. They work the same as <tt>=</tt> and <tt>~</tt> without a tag;
0
+see below for documentation of those. For example:
0
 
0
- #things
0
- %span#rice Chicken Fried
0
- %p.beans The magical fruit
0
+ %p= "hello"
0
+ %h1~ 1 + 2
0
+
0
+is the same as:
0
+
0
+ %p
0
+ = "hello"
0
+ %h1
0
+ ~ 1 + 2
0
+
0
+and is compiled to:
0
+
0
+ <p>
0
+ hello
0
+ </p>
0
+ <h1>
0
+ 3
0
+ </h1>
0
+
0
+=== XHTML Helpers
0
+
0
+==== No Special Character
0
+
0
+If no special character appears at the beginning of a line, it is rendered as plain
0
+text. For example:
0
+
0
+ %gee
0
+ %whiz
0
+ Wow this is cool!
0
 
0
 is compiled to:
0
 
0
- <div id='things'>
0
- <span id='rice'>Chicken Fried</span>
0
- <p class='beans'>The magical fruit</p>
0
- </div>
0
+ <gee>
0
+ <whiz>
0
+ Wow this is cool!
0
+ </whiz>
0
+ </gee>
0
   
0
-=== Specifying a document type
0
+==== !!!
0
 
0
-When describing xhtml documents with Haml, you can have a document type
0
+When describing XHTML documents with Haml, you can have a document type
0
 generated automatically by including the characters <tt>!!!</tt> as the first
0
 line in your document. Example:
0
 
0
@@ -139,11 +255,158 @@ is compiled to:
0
       <p>Sign my guestbook</p>
0
     </body>
0
   </html>
0
+
0
+==== /
0
+
0
+The forward slash character, when placed at the beginning of a line, wraps all
0
+text after it in an HTML comment. For example:
0
+
0
+ %billabong
0
+ / This is the billabong element
0
+ I like billabongs!
0
+
0
+is compiled to:
0
+
0
+ <billabong>
0
+ <!-- This is the billabong element -->
0
+ I like billabongs!
0
+ </billabong>
0
+
0
+==== |
0
+
0
+The pipe character designates a multiline string. It's placed at the end of a line,
0
+and means that all following lines that end with <tt>|</tt> will be evaluated as
0
+though they were on the same line. For example:
0
+
0
+ %whoo
0
+ %hoo I think this might get |
0
+ pretty long so I should |
0
+ probably make it |
0
+ multiline so it doesn't |
0
+ look awful. |
0
+ %p This is short.
0
+
0
+is compiled to:
0
+
0
+ %hoo I think this might get |
0
+ pretty long so I should |
0
+ probably make it |
0
+ multiline so it doesn't |
0
+ look awful. |
0
+
0
+=== Ruby evaluators
0
+
0
+==== =
0
+
0
+The equals character is followed by Ruby code, which is evaluated and the output
0
+inserted into the document as plain text. For example:
0
+
0
+ %p
0
+ = ['hi', 'there', 'reader!'].join " "
0
+ = "yo"
0
+
0
+is compiled to:
0
+
0
+ <p>
0
+ hi there reader!
0
+ yo
0
+ </p>
0
+
0
+==== ~
0
+
0
+The tilde character works the same as the equals character, but the output is
0
+modified in such a way that newlines in whitespace-sensitive elements work
0
+properly. For example:
0
+
0
+ %foo
0
+ = "Woah <pre> this is \n</pre> crazy"
0
+ %foo2
0
+ ~ "Woah <pre> this is \n</pre> crazy"
0
+
0
+is compiled to:
0
+
0
+ <foo>
0
+ Woah <pre> this is
0
+ </pre> crazy
0
+ </foo>
0
+ <foo2>
0
+ Woah <pre> this is &#x000A;</pre> crazy
0
+ </foo2>
0
+
0
+==== -
0
+
0
+The hyphen character makes the text following it into "silent script", or
0
+Ruby script that is evaluated, but not output.
0
+
0
+<b>It is not reccomended that you use this widely; almost all processing
0
+code and logic should be kept to the Controller, the Helper, or partials.</b>
0
+
0
+For example:
0
+
0
+ - foo = "hello"
0
+ - foo << " there"
0
+ - foo << " you!"
0
+ %p= foo
0
+
0
+is compiled to:
0
+
0
+ <p>
0
+ hello there you!
0
+ </p>
0
+
0
+===== Blocks
0
+
0
+Like XHTML tags, you don't need to explicity close your Ruby blocks in
0
+HAML. Rather, they're automatically closed based on tabs. A block begins
0
+whenever the indentation is increased after a silent script command, and
0
+ends when the indentation decreases (as long as it's not an +else+ clause
0
+or something similar). For example:
0
+
0
+ - (42...47).each do |i|
0
+ %p= i
0
+ %p See, I can count!
0
+
0
+is compiled to:
0
+
0
+ <p>
0
+ 42
0
+ </p>
0
+ <p>
0
+ 43
0
+ </p>
0
+ <p>
0
+ 44
0
+ </p>
0
+ <p>
0
+ 45
0
+ </p>
0
+ <p>
0
+ 46
0
+ </p>
0
+
0
+Another example:
0
+
0
+ %p
0
+ - case 2
0
+ - when 1
0
+ = "1!"
0
+ - when 2
0
+ = "2?"
0
+ - when 3
0
+ = "3."
0
+
0
+is compiled to:
0
+
0
+ <p>
0
+ 2?
0
+ </p>
0
 
0
 == Using Haml as a Rails plugin
0
 
0
 Write Rails templates with the .haml extension. Example:
0
 
0
+ # file: app/views/movies/teen_wolf.haml
0
+
0
   %html
0
     %head
0
       %title= "Teen Wolf (1985)"
0
@@ -176,12 +439,9 @@ is compiled to:
0
   </html>
0
 
0
 You can access instance variables in Haml templates the same way you do in ERb
0
-templates. Helper methods are also available in Haml templates. To specify that
0
-a line should be evaulated as Ruby, use the <tt>=</tt> character at the begining
0
-of a line, or immediately following an element name. The return value of the
0
-method call will be inserted into the stream. Example:
0
+templates. Helper methods are also available in Haml templates. Example:
0
 
0
- file: app/controllers/movies_controller.rb
0
+ # file: app/controllers/movies_controller.rb
0
 
0
   class MoviesController < ApplicationController
0
     def index
0
@@ -189,14 +449,14 @@ method call will be inserted into the stream. Example:
0
     end
0
   end
0
 
0
- file: app/views/movies/index.haml
0
+ # file: app/views/movies/index.haml
0
 
0
   #content
0
    .title
0
      %h1= @title
0
      = link_to 'Home', home_url
0
  
0
-is be compiled to:
0
+may be compiled to:
0
 
0
   <div id='content'>
0
     <div class='title'>
0
@@ -206,8 +466,6 @@ is be compiled to:
0
   </div>
0
 
0
 
0
-
0
-
0
 ---
0
 Copyright (c) 2006 Hampton Catlin
0
 Licensed under the MIT License
...
 
1
2
3
4
 
 
 
 
 
 
 
 
 
 
 
 
5
6
7
...
13
14
15
16
 
 
 
 
 
 
 
17
18
 
 
 
19
20
 
 
 
 
21
22
23
24
25
26
 
 
 
27
28
29
30
 
31
32
33
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
...
1
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
25
26
27
 
28
29
30
31
32
33
34
35
 
36
37
38
39
 
40
41
42
43
44
45
46
 
 
 
47
48
49
50
51
52
53
54
55
56
 
 
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
0
@@ -1,7 +1,19 @@
0
+require 'rubygems'
0
 require 'rake'
0
 require 'rake/testtask'
0
 require 'rake/rdoctask'
0
-$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
0
+
0
+volatile_requires = ['rcov/rcovtask']
0
+not_loaded = []
0
+volatile_requires.each do |file|
0
+ begin
0
+ require file
0
+ rescue LoadError
0
+ not_loaded.push file
0
+ end
0
+end
0
+
0
+# ----- Default: Testing ------
0
 
0
 desc 'Default: run unit tests.'
0
 task :default => :test
0
@@ -13,23 +25,79 @@ Rake::TestTask.new(:test) do |t|
0
   t.verbose = true
0
 end
0
 
0
-desc 'Benchmark HAML against ERb. The benchmark routine is run 100. Use TIMES=n to override'
0
+# ----- Benchmarking -----
0
+
0
+temp_desc = <<END
0
+Benchmark HAML against ERb.
0
+ TIMES=n sets the number of runs. Defaults to 100.
0
+END
0
+desc temp_desc.chomp
0
 task :benchmark do
0
- puts '-'*51, "+ Benchmark: HAML vs. ERb", '-'*51
0
+ require 'test/benchmark'
0
+
0
+ puts '-'*51, "Benchmark: HAML vs. ERb", '-'*51
0
   puts "Running benchmark #{ENV['TIMES']} times..." if ENV['TIMES']
0
- puts `ruby test/benchmark.rb #{ENV['TIMES']}`
0
+ args = []
0
+ args.push ENV['TIMES'].to_i if ENV['TIMES']
0
+ benchmarker = Haml::Benchmarker.new
0
+ puts benchmarker.benchmark(*args)
0
   puts '-'*51
0
 end
0
 
0
-desc 'Generate documentation for the haml plugin.'
0
-Rake::RDocTask.new(:rdoc) do |rdoc|
0
- rdoc.rdoc_dir = 'rdoc'
0
+# ----- Documentation -----
0
+
0
+rdoc_task = Proc.new do |rdoc|
0
   rdoc.title = 'Haml'
0
   rdoc.options << '--line-numbers' << '--inline-source'
0
   rdoc.rdoc_files.include('README')
0
   rdoc.rdoc_files.include('lib/**/*.rb')
0
+ rdoc.rdoc_files.exclude('lib/haml/buffer.rb')
0
 end
0
 
0
-task :rcov do
0
- `rcov test/*.rb`
0
+Rake::RDocTask.new do |rdoc|
0
+ rdoc_task.call(rdoc)
0
+ rdoc.rdoc_dir = 'rdoc'
0
+end
0
+
0
+Rake::RDocTask.new(:rdoc_devel) do |rdoc|
0
+ rdoc_task.call(rdoc)
0
+ rdoc.rdoc_dir = 'rdoc_devel'
0
+ rdoc.options << '--all'
0
+ rdoc.rdoc_files.include('test/*.rb')
0
+ rdoc.rdoc_files = Rake::FileList.new(*rdoc.rdoc_files.to_a)
0
+ rdoc.rdoc_files.include('lib/haml/buffer.rb')
0
+end
0
+
0
+# ----- Coverage -----
0
+
0
+unless not_loaded.include? 'rcov/rcovtask'
0
+ Rcov::RcovTask.new do |t|
0
+ t.libs << "test"
0
+ t.test_files = FileList['test/*_test.rb']
0
+ t.verbose = true
0
+ end
0
+end
0
+
0
+# ----- Profiling -----
0
+
0
+temp_desc = <<END
0
+Run a profile of HAML.
0
+ TIMES=n sets the number of runs. Defaults to 100.
0
+ FILE=n sets the file to profile. Defaults to 'standard'.
0
+END
0
+desc temp_desc.chomp
0
+task :profile do
0
+ require 'test/profile'
0
+
0
+ puts '-'*51, "Profiling HAML::Template", '-'*51
0
+
0
+ args = []
0
+ args.push ENV['TIMES'].to_i if ENV['TIMES']
0
+ args.push ENV['FILE'] if ENV['FILE']
0
+
0
+ profiler = Haml::Profiler.new
0
+ res = profiler.profile(*args)
0
+ puts res
0
+
0
+ puts '-'*51
0
 end
...
1
 
 
2
3
 
 
 
 
 
 
 
 
 
4
5
6
7
8
9
10
 
 
 
11
 
 
 
12
 
 
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
18
19
20
 
 
 
 
 
21
22
 
 
23
24
25
26
27
 
28
29
30
 
 
31
32
33
 
 
 
 
34
35
36
 
 
 
 
 
37
38
 
39
 
 
40
41
42
43
 
 
 
 
 
 
 
 
 
 
44
45
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
64
65
66
67
 
 
 
 
 
 
 
 
68
69
 
70
71
72
73
 
 
74
75
76
77
 
 
78
79
80
 
81
82
 
83
84
85
86
87
88
89
90
91
92
 
93
94
95
96
97
98
99
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
102
103
104
105
106
107
108
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
111
112
113
 
 
 
 
 
 
 
 
 
114
115
116
117
 
 
 
 
118
119
120
121
 
 
 
 
 
 
 
 
 
 
122
123
124
125
126
127
128
129
130
131
132
 
 
 
 
 
133
134
135
 
136
137
138
139
140
141
 
 
 
 
 
142
143
144
145
146
147
148
149
150
151
152
153
154
 
 
 
 
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
 
 
 
 
 
 
173
174
175
 
176
177
178
179
 
 
180
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
183
184
185
186
187
 
 
 
 
188
189
 
190
191
192
193
194
195
 
196
197
198
...
1
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
 
 
 
 
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
62
63
64
65
66
67
68
69
70
71
72
73
74
 
75
76
 
 
77
78
79
80
 
81
82
83
84
85
 
 
86
87
88
89
90
91
 
92
93
94
95
96
 
 
 
97
98
99
100
101
102
103
104
105
106
107
 
 
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
 
152
153
 
154
155
156
157
158
159
160
161
162
 
163
164
165
 
 
166
167
168
169
170
 
171
172
173
174
 
175
176
 
177
178
 
 
 
179
 
 
 
 
 
180
181
182
 
 
 
 
 
 
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
 
 
 
 
 
 
 
 
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
 
 
230
231
232
233
234
235
236
237
238
239
240
 
 
241
242
243
244
245
246
 
 
247
248
249
250
251
252
253
254
255
256
257
258
 
 
 
 
 
 
 
 
 
259
260
261
262
263
264
 
 
265
266
267
268
 
 
 
269
270
271
272
273
274
 
 
 
 
 
 
 
 
 
 
 
 
275
276
277
278
279
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
282
283
284
285
286
287
288
 
289
290
 
 
 
291
292
293
 
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
 
 
319
320
321
322
323
324
325
326
 
 
 
 
 
327
328
329
330
0
@@ -1,198 +1,330 @@
0
 require File.dirname(__FILE__) + '/helpers'
0
+require File.dirname(__FILE__) + '/buffer'
0
+require 'profiler'
0
 
0
-module Haml #:nodoc:
0
+module Haml
0
+ # This is the class where all the parsing and processing of the HAML
0
+ # template is done. It can be directly used by the user by creating a
0
+ # new instance and calling to_html to render the template. For example:
0
+ #
0
+ # template = File.load('templates/really_cool_template.haml')
0
+ # haml_engine = Haml::Engine.new(template)