public
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/indirect/haml.git
Search Repo:
Get rid of trailing whitespace.
nex3 (author)
Mon Apr 07 23:09:17 -0700 2008
commit  84fdde13a5b76994fd34700cf96e97e392b067ae
tree    de124d477239e152ebe2873876fb70acb61bcf16
parent  d4d176b138940a31b258ed8f4340381d8f355a17
...
67
68
69
70
 
71
72
73
...
235
236
237
238
239
 
 
240
241
242
...
67
68
69
 
70
71
72
73
...
235
236
237
 
 
238
239
240
241
242
0
@@ -67,7 +67,7 @@ a tag without a name defaults to a div. So
0
 becomes
0
 
0
   <div id='foo'>Hello!</div>
0
-
0
+
0
 Haml uses indentation
0
 to bring the individual elements to represent the HTML structure.
0
 A tag's children are indented two spaces more than the parent tag.
0
@@ -235,8 +235,8 @@ the documentation for the Sass module.
0
 
0
 Haml and Sass are designed by Hampton Catlin (hcatlin) and he is the author
0
 of the original implementation. However, Hampton doesn't even know his way
0
-around the code anymore and mostly just concentrates on the language issues.
0
-Hampton lives in Toronto, Ontario (though he's an American by birth) and
0
+around the code anymore and mostly just concentrates on the language issues.
0
+Hampton lives in Toronto, Ontario (though he's an American by birth) and
0
 is a partner at Unspace Interactive.
0
 
0
 Nathan Weizenbaum is the primary maintainer and architect of the "modern" Ruby
...
68
69
70
71
 
72
73
74
...
133
134
135
136
 
137
138
139
...
167
168
169
170
 
171
172
 
173
174
175
176
 
177
178
179
180
 
181
182
183
...
68
69
70
 
71
72
73
74
...
133
134
135
 
136
137
138
139
...
167
168
169
 
170
171
 
172
173
174
175
 
176
177
178
179
 
180
181
182
183
0
@@ -68,7 +68,7 @@ END
0
       but it can function as a stand-alone templating engine.
0
     END
0
     #'
0
-
0
+
0
     readmes = FileList.new('*') do |list|
0
       list.exclude(/(^|[^.a-z])[a-z]+/)
0
       list.exclude('TODO')
0
@@ -133,7 +133,7 @@ END
0
     rdoc.rdoc_dir = 'rdoc_devel'
0
     rdoc.options << '--all'
0
     rdoc.rdoc_files.include('test/*.rb')
0
-
0
+
0
     # Get rid of exclusion rules
0
     rdoc.rdoc_files = Rake::FileList.new(*rdoc.rdoc_files.to_a)
0
     rdoc.rdoc_files.include('lib/haml/buffer.rb')
0
@@ -167,17 +167,17 @@ END
0
     require 'test/profile'
0
 
0
     engine = ENV['ENGINE'] && ENV['ENGINE'].downcase == 'sass' ? Sass : Haml
0
-
0
+
0
     puts '-'*51, "Profiling #{engine}", '-'*51
0
-
0
+
0
     args = []
0
     args.push ENV['TIMES'].to_i if ENV['TIMES']
0
     args.push ENV['FILE'] if ENV['FILE']
0
-
0
+
0
     profiler = engine::Profiler.new
0
     res = profiler.profile(*args)
0
     puts res
0
-
0
+
0
     puts '-'*51
0
   end
0
 
...
7
8
9
10
 
11
12
13
 
14
15
16
...
7
8
9
 
10
11
12
 
13
14
15
16
0
@@ -7,10 +7,10 @@
0
 ;;; functions are similar to those in yaml-mode and python-mode.
0
 
0
 ;;; To install, save this somewhere and add the following to your .emacs file:
0
-;;;
0
+;;;
0
 ;;; (add-to-list 'load-path "/path/to/haml-mode.el")
0
 ;;; (require 'haml-mode nil 't)
0
-;;;
0
+;;;
0
 
0
 ;;; Code:
0
 
...
2
3
4
5
 
6
7
8
9
10
11
 
 
12
13
14
 
15
16
 
17
18
19
...
36
37
38
39
 
40
41
 
42
43
44
...
50
51
52
53
 
54
55
 
56
57
58
59
60
61
 
62
63
 
64
65
66
67
68
 
69
70
 
71
72
73
...
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
...
132
133
134
135
 
136
137
138
139
 
140
141
 
142
143
144
...
200
201
202
203
 
204
205
206
...
211
212
213
214
 
215
216
 
217
218
219
...
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
...
271
272
273
274
 
275
276
 
277
278
279
...
281
282
283
284
 
285
286
287
288
289
 
290
291
 
292
293
294
295
296
297
 
298
299
 
300
301
302
...
305
306
307
308
 
309
310
 
311
312
313
...
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
...
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
...
400
401
402
403
 
404
405
 
406
407
408
...
414
415
416
417
 
418
419
420
421
422
 
423
424
 
425
426
 
427
428
 
429
430
 
431
432
 
433
434
 
435
436
 
437
438
439
440
441
 
442
443
 
444
445
 
446
447
 
448
449
 
450
451
452
453
 
454
455
456
457
 
458
459
 
460
461
462
463
464
 
465
466
 
467
468
469
470
471
 
472
473
 
474
475
476
477
478
479
480
 
481
482
483
484
485
 
486
487
488
489
 
490
491
 
492
493
494
495
496
497
 
498
499
 
500
501
502
503
 
504
505
506
507
 
508
509
 
510
511
512
513
514
 
515
516
 
517
518
519
520
521
522
 
523
524
525
...
527
528
529
530
 
531
532
 
533
534
535
...
613
614
615
616
 
617
618
 
619
620
 
621
622
623
624
 
625
626
627
628
 
629
630
 
631
632
633
...
642
643
644
645
 
646
647
 
648
649
650
 
651
652
653
654
 
655
656
 
657
658
659
660
661
 
662
663
 
664
665
666
667
 
668
669
670
...
729
730
731
732
 
733
734
735
...
737
738
739
740
 
741
742
743
744
 
745
746
 
747
748
749
...
759
760
761
762
 
763
764
 
765
766
767
...
770
771
772
773
 
774
775
 
776
777
778
...
783
784
785
786
 
787
788
789
...
809
810
811
812
 
813
814
815
...
819
820
821
822
 
823
824
 
825
826
827
...
842
843
844
845
 
846
847
848
...
2
3
4
 
5
6
7
8
9
 
 
10
11
12
13
 
14
15
 
16
17
18
19
...
36
37
38
 
39
40
 
41
42
43
44
...
50
51
52
 
53
54
 
55
56
57
58
59
60
 
61
62
 
63
64
65
66
67
 
68
69
 
70
71
72
73
...
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
...
132
133
134
 
135
136
137
138
 
139
140
 
141
142
143
144
...
200
201
202
 
203
204
205
206
...
211
212
213
 
214
215
 
216
217
218
219
...
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
...
271
272
273
 
274
275
 
276
277
278
279
...
281
282
283
 
284
285
286
287
288
 
289
290
 
291
292
293
294
295
296
 
297
298
 
299
300
301
302
...
305
306
307
 
308
309
 
310
311
312
313
...
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
...
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
...
400
401
402
 
403
404
 
405
406
407
408
...
414
415
416
 
417
418
419
420
421
 
422
423
 
424
425
 
426
427
 
428
429
 
430
431
 
432
433
 
434
435
 
436
437
438
439
440
 
441
442
 
443
444
 
445
446
 
447
448
 
449
450
451
452
 
453
454
455
456
 
457
458
 
459
460
461
462
463
 
464
465
 
466
467
468
469
470
 
471
472
 
473
474
475
476
477
478
479
 
480
481
482
483
484
 
485
486
487
488
 
489
490
 
491
492
493
494
495
496
 
497
498
 
499
500
501
502
 
503
504
505
506
 
507
508
 
509
510
511
512
513
 
514
515
 
516
517
518
519
520
521
 
522
523
524
525
...
527
528
529
 
530
531
 
532
533
534
535
...
613
614
615
 
616
617
 
618
619
 
620
621
622
623
 
624
625
626
627
 
628
629
 
630
631
632
633
...
642
643
644
 
645
646
 
647
648
649
 
650
651
652
653
 
654
655
 
656
657
658
659
660
 
661
662
 
663
664
665
666
 
667
668
669
670
...
729
730
731
 
732
733
734
735
...
737
738
739
 
740
741
742
743
 
744
745
 
746
747
748
749
...
759
760
761
 
762
763
 
764
765
766
767
...
770
771
772
 
773
774
 
775
776
777
778
...
783
784
785
 
786
787
788
789
...
809
810
811
 
812
813
814
815
...
819
820
821
 
822
823
 
824
825
826
827
...
842
843
844
 
845
846
847
848
0
@@ -2,18 +2,18 @@ dir = File.dirname(__FILE__)
0
 $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 
0
 # = Haml (XHTML Abstraction Markup Language)
0
-#
0
+#
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
-#
0
+#
0
 # == Features
0
-#
0
+#
0
 # * Whitespace active
0
 # * Well-formatted markup
0
 # * DRY
0
@@ -36,9 +36,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 #
0
 # To enable it as a Rails plugin,
0
 # then run
0
-#
0
+#
0
 # haml --rails path/to/rails/app
0
-#
0
+#
0
 # Haml is enabled in Merb by default,
0
 # so Merb users don't have to do anything more.
0
 #
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
-#
0
+#
0
 # # file: app/controllers/movies_controller.rb
0
-#
0
+#
0
 # class MoviesController < ApplicationController
0
 # def index
0
 # @title = "Teen Wolf"
0
 # end
0
 # end
0
-#
0
+#
0
 # -# file: app/views/movies/index.haml
0
-#
0
+#
0
 # #content
0
 # .title
0
 # %h1= @title
0
 # = link_to 'Home', home_url
0
-#
0
+#
0
 # may be compiled to:
0
-#
0
+#
0
 # <div id='content'>
0
 # <div class='title'>
0
 # <h1>Teen Wolf</h1>
0
@@ -89,41 +89,41 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 # engine.render #=> "<p>Haml code!</p>\n"
0
 #
0
 # == Characters with meaning to Haml
0
-#
0
+#
0
 # Various characters, when placed at a certain point in a line,
0
 # instruct Haml to render different types of things.
0
-#
0
+#
0
 # === XHTML Tags
0
-#
0
+#
0
 # These characters render XHTML tags.
0
-#
0
+#
0
 # ==== %
0
-#
0
-#
0
+#
0
+#
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
 # For example:
0
-#
0
+#
0
 # %one
0
 # %two
0
 # %three Hey there
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <one>
0
 # <two>
0
 # <three>Hey there</three>
0
 # </two>
0
 # </one>
0
-#
0
+#
0
 # Any string is a valid element name;
0
 # Haml will automatically generate opening and closing tags for any element.
0
-#
0
+#
0
 # ==== {}
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # %head{ :name => "doc_head" }
0
 # %script{ 'type' => "text/" + "javascript",
0
 # :src => "javascripts/script_#{2 + 7}" }
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <head name="doc_head">
0
 # <script src='javascripts/script_9' type='text/javascript'>
0
 # </script>
0
@@ -200,7 +200,7 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 #
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
-#
0
+#
0
 # <input selected="selected">
0
 #
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
 # will just render as
0
 #
0
 # <input>
0
-#
0
+#
0
 # ==== []
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # # file: app/controllers/users_controller.rb
0
-#
0
+#
0
 # def show
0
 # @user = CrazyUser.find(15)
0
 # end
0
-#
0
+#
0
 # -# file: app/views/users/show.haml
0
-#
0
+#
0
 # %div[@user]
0
 # %bar[290]/
0
 # Hello!
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <div class="crazy_user" id="crazy_user_15">
0
 # <bar class="fixnum" id="fixnum_581" />
0
 # Hello!
0
 # </div>
0
-#
0
+#
0
 # This is based off of DHH's SimplyHelpful syntax,
0
 # as presented at RailsConf Europe 2006.
0
-#
0
+#
0
 # ==== /
0
-#
0
+#
0
 # The forward slash character, when placed at the end of a tag definition,
0
 # causes the tag to be self-closed.
0
 # For example:
0
-#
0
+#
0
 # %br/
0
 # %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <br />
0
 # <meta http-equiv='Content-Type' content='text/html' />
0
 #
0
@@ -271,9 +271,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 #
0
 # <br />
0
 # <meta http-equiv='Content-Type' content='text/html' />
0
-#
0
+#
0
 # ==== . and #
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # %div#things
0
 # %span#rice Chicken Fried
0
 # %p.beans{ :food => 'true' } The magical fruit
0
 # %h1.class.otherclass#id La La La
0
-#
0
+#
0
 # is compiled to:
0
-#
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 otherclass' id='id'>La La La</h1>
0
 # </div>
0
-#
0
+#
0
 # And,
0
-#
0
+#
0
 # #content
0
 # .articles
0
 # .article.title
0
@@ -305,9 +305,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 # 2006-11-05
0
 # .article.entry
0
 # Neil Patrick Harris would like to dispel any rumors that he is straight
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <div id="content">
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
 # </div>
0
 # </div>
0
 # </div>
0
-#
0
+#
0
 # ==== Implicit Div Elements
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # #collection
0
 # .item
0
 # .description What a cool item!
0
-#
0
+#
0
 # is the same as:
0
-#
0
+#
0
 # %div{:id => collection}
0
 # %div{:class => 'item'}
0
 # %div{:class => 'description'} What a cool item!
0
-#
0
+#
0
 # and is compiled to:
0
-#
0
+#
0
 # <div id='collection'>
0
 # <div class='item'>
0
 # <div class='description'>What a cool item!</div>
0
 # </div>
0
 # </div>
0
-#
0
+#
0
 # ==== =
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # %p= "hello"
0
-#
0
+#
0
 # is not quite the same as:
0
-#
0
+#
0
 # %p
0
 # = "hello"
0
-#
0
+#
0
 # It's compiled to:
0
-#
0
+#
0
 # <p>hello</p>
0
-#
0
+#
0
 # === XHTML Helpers
0
-#
0
+#
0
 # ==== No Special Character
0
-#
0
+#
0
 # If no special character appears at the beginning of a line,
0
 # the line is rendered as plain text.
0
 # For example:
0
-#
0
+#
0
 # %gee
0
 # %whiz
0
 # Wow this is cool!
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <gee>
0
 # <whiz>
0
 # Wow this is cool!
0
 # </whiz>
0
 # </gee>
0
-#
0
+#
0
 # ==== !!!
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # !!! XML
0
 # !!!
0
 # %html
0
@@ -400,9 +400,9 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 # %body
0
 # %h1 I am the international space station
0
 # %p Sign my guestbook
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
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
 # <html>
0
@@ -414,112 +414,112 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
0
 # <p>Sign my guestbook</p>
0
 # </body>
0
 # </html>
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # !!! 1.1
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
0
-#
0
+#
0
 # and
0
-#
0
+#
0
 # !!! Strict
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0
-#
0
+#
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
 # For example:
0
-#
0
+#
0
 # !!! XML iso-8859-1
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <?xml version="1.0" encoding="iso-8859-1" ?>
0
-#
0
+#
0
 # ==== /
0
-#
0
+#
0
 # The forward slash character, when placed at the beginning of a line,
0
 # wraps all text after it in an HTML comment.
0
 # For example:
0
-#
0
+#
0
 # %peanutbutterjelly
0
 # / This is the peanutbutterjelly element
0
 # I like sandwiches!
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#
0
 # <peanutbutterjelly>
0
 # <!-- This is the peanutbutterjelly element -->
0
 # I like sandwiches!
0
 # </peanutbutterjelly>
0
-#
0
+#
0
 # The forward slash can also wrap indented sections of code. For example:
0
-#
0
+#
0
 # /
0
 # %p This doesn't render...
0
 # %div
0
 # %h1 Because it's commented out!
0
-#
0
+#
0
 # is compiled to:
0
-#
0
+#