haml 1.0.5 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (92) hide show
  1. data/README +229 -0
  2. data/Rakefile +56 -60
  3. data/VERSION +1 -1
  4. data/bin/haml +4 -14
  5. data/bin/html2haml +89 -0
  6. data/bin/sass +8 -0
  7. data/init.rb +5 -1
  8. data/lib/haml.rb +643 -0
  9. data/lib/haml/buffer.rb +33 -30
  10. data/lib/haml/engine.rb +258 -75
  11. data/lib/haml/error.rb +43 -0
  12. data/lib/haml/exec.rb +181 -0
  13. data/lib/haml/filters.rb +89 -0
  14. data/lib/haml/helpers.rb +19 -5
  15. data/lib/haml/helpers/action_view_mods.rb +28 -4
  16. data/lib/haml/template.rb +13 -27
  17. data/lib/sass.rb +418 -0
  18. data/lib/sass/constant.rb +190 -0
  19. data/lib/sass/constant/color.rb +77 -0
  20. data/lib/sass/constant/literal.rb +51 -0
  21. data/lib/sass/constant/number.rb +87 -0
  22. data/lib/sass/constant/operation.rb +30 -0
  23. data/lib/sass/constant/string.rb +18 -0
  24. data/lib/sass/engine.rb +179 -0
  25. data/lib/sass/error.rb +35 -0
  26. data/lib/sass/plugin.rb +119 -0
  27. data/lib/sass/tree/attr_node.rb +44 -0
  28. data/lib/sass/tree/node.rb +29 -0
  29. data/lib/sass/tree/rule_node.rb +47 -0
  30. data/lib/sass/tree/value_node.rb +12 -0
  31. data/test/benchmark.rb +16 -19
  32. data/test/haml/engine_test.rb +220 -0
  33. data/test/{helper_test.rb → haml/helper_test.rb} +9 -8
  34. data/test/{mocks → haml/mocks}/article.rb +0 -0
  35. data/test/{results → haml/results}/content_for_layout.xhtml +0 -0
  36. data/test/{results → haml/results}/eval_suppressed.xhtml +0 -0
  37. data/test/haml/results/filters.xhtml +57 -0
  38. data/test/{results → haml/results}/helpers.xhtml +10 -0
  39. data/test/haml/results/helpful.xhtml +8 -0
  40. data/test/{results → haml/results}/just_stuff.xhtml +5 -0
  41. data/test/{results → haml/results}/list.xhtml +0 -0
  42. data/test/{results → haml/results}/original_engine.xhtml +1 -1
  43. data/test/{results → haml/results}/partials.xhtml +0 -0
  44. data/test/{results → haml/results}/silent_script.xhtml +0 -0
  45. data/test/{results → haml/results}/standard.xhtml +2 -1
  46. data/test/{results → haml/results}/tag_parsing.xhtml +0 -0
  47. data/test/{results → haml/results}/very_basic.xhtml +0 -0
  48. data/test/haml/results/whitespace_handling.xhtml +104 -0
  49. data/test/{rhtml → haml/rhtml}/standard.rhtml +4 -1
  50. data/test/{runner.rb → haml/runner.rb} +1 -1
  51. data/test/{template_test.rb → haml/template_test.rb} +28 -23
  52. data/test/{templates → haml/templates}/_partial.haml +0 -0
  53. data/test/{templates → haml/templates}/_text_area.haml +0 -0
  54. data/test/haml/templates/breakage.haml +8 -0
  55. data/test/{templates → haml/templates}/content_for_layout.haml +0 -0
  56. data/test/{templates → haml/templates}/eval_suppressed.haml +0 -0
  57. data/test/haml/templates/filters.haml +53 -0
  58. data/test/{templates → haml/templates}/helpers.haml +10 -1
  59. data/test/{templates → haml/templates}/helpful.haml +3 -0
  60. data/test/{templates → haml/templates}/just_stuff.haml +7 -0
  61. data/test/{templates → haml/templates}/list.haml +0 -0
  62. data/test/haml/templates/original_engine.haml +17 -0
  63. data/test/{templates → haml/templates}/partialize.haml +0 -0
  64. data/test/{templates → haml/templates}/partials.haml +0 -0
  65. data/test/{templates → haml/templates}/silent_script.haml +0 -0
  66. data/test/{templates → haml/templates}/standard.haml +3 -1
  67. data/test/{templates → haml/templates}/tag_parsing.haml +0 -0
  68. data/test/{templates → haml/templates}/very_basic.haml +0 -0
  69. data/test/haml/templates/whitespace_handling.haml +137 -0
  70. data/test/profile.rb +36 -18
  71. data/test/sass/engine_test.rb +87 -0
  72. data/test/sass/plugin_test.rb +103 -0
  73. data/test/sass/results/basic.css +9 -0
  74. data/test/sass/results/compact.css +5 -0
  75. data/test/sass/results/complex.css +86 -0
  76. data/test/sass/results/constants.css +12 -0
  77. data/test/sass/results/expanded.css +18 -0
  78. data/test/sass/results/nested.css +14 -0
  79. data/test/sass/templates/basic.sass +23 -0
  80. data/test/sass/templates/bork.sass +2 -0
  81. data/test/sass/templates/compact.sass +15 -0
  82. data/test/sass/templates/complex.sass +291 -0
  83. data/test/sass/templates/constants.sass +80 -0
  84. data/test/sass/templates/expanded.sass +15 -0
  85. data/test/sass/templates/nested.sass +15 -0
  86. metadata +98 -48
  87. data/REFERENCE +0 -662
  88. data/test/engine_test.rb +0 -93
  89. data/test/results/helpful.xhtml +0 -5
  90. data/test/results/whitespace_handling.xhtml +0 -51
  91. data/test/templates/original_engine.haml +0 -17
  92. data/test/templates/whitespace_handling.haml +0 -66
@@ -0,0 +1,9 @@
1
+ body { font: Arial; background: blue; }
2
+
3
+ #page { width: 700px; height: 100; }
4
+ #page #header { height: 300px; }
5
+ #page #header h1 { font-size: 50px; color: blue; }
6
+
7
+ #content.user.show #container.top #column.left { width: 100px; }
8
+ #content.user.show #container.top #column.right { width: 600px; }
9
+ #content.user.show #container.bottom { background: brown; }
@@ -0,0 +1,5 @@
1
+ #main { width: 15em; color: #0000ff; }
2
+ #main p { border-style: dotted; border-width: 2px; }
3
+ #main .cool { width: 100px; }
4
+
5
+ #left { font-size: 2em; font-weight: bold; float: left; }
@@ -0,0 +1,86 @@
1
+ body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; color: #fff; background: url(/images/global_bg.gif); }
2
+
3
+ #page { width: 900px; margin: 0 auto; background: #440008; border-top-width: 5px; border-top-style: solid; border-top-color: #ff8500; }
4
+
5
+ #header { height: 75px; padding: 0; }
6
+ #header h1 { float: left; width: 274px; height: 75px; margin: 0; background-image: url(/images/global_logo.gif); background-repeat: no-repeat; text-indent: -9999px; }
7
+ #header .status { float: right; padding-top: .5em; padding-left: .5em; padding-right: .5em; padding-bottom: 0; }
8
+ #header .status p { float: left; margin-top: 0; margin-right: 0.5em; margin-bottom: 0; margin-left: 0; }
9
+ #header .status ul { float: left; margin: 0; padding: 0; }
10
+ #header .status li { list-style-type: none; display: inline; margin: 0 5px; }
11
+ #header .status a:link, #header .status a:visited { color: #ff8500; text-decoration: none; }
12
+ #header .status a:hover { text-decoration: underline; }
13
+ #header .search { float: right; clear: right; margin: 12px 0 0 0; }
14
+ #header .search form { margin: 0; }
15
+ #header .search input { margin: 0 3px 0 0; padding: 2px; border: none; }
16
+
17
+ #menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background: #00a4e4; }
18
+ #menu .contests ul { margin: 0 5px 0 0; padding: 0; }
19
+ #menu .contests ul li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: #fff; background: #00a4e4; }
20
+ #menu .contests a:link, #menu .contests a:visited { color: #fff; text-decoration: none; font-weight: bold; }
21
+ #menu .contests a:hover { text-decoration: underline; }
22
+
23
+ #content { clear: both; }
24
+ #content .container { clear: both; }
25
+ #content .container .column { float: left; }
26
+ #content .container .column .right { float: right; }
27
+ #content a:link, #content a:visited { color: #93d700; text-decoration: none; }
28
+ #content a:hover { text-decoration: underline; }
29
+
30
+ #content p, #content div { width: 40em; }
31
+ #content p li, #content p dt, #content p dd, #content div li, #content div dt, #content div dd { color: #ddffdd; background-color: #4792bb; }
32
+ #content .container.video .column.left { width: 200px; }
33
+ #content .container.video .column.left .box { margin-top: 10px; }
34
+ #content .container.video .column.left .box p { margin: 0 1em auto 1em; }
35
+ #content .container.video .column.left .box.participants img { float: left; margin: 0 1em auto 1em; border: 1px solid #6e000d; }
36
+ #content .container.video .column.left .box.participants h2 { margin: 0 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat; text-indent: -9999px; border-top-width: 5px; border-top-style: solid; border-top-color: #a20013; border-right-width: 1px; border-right-style: dotted; }
37
+ #content .container.video .column.middle { width: 500px; }
38
+ #content .container.video .column.right { width: 200px; }
39
+ #content .container.video .column.right .box { margin-top: 0; }
40
+ #content .container.video .column.right .box p { margin: 0 1em auto 1em; }
41
+ #content .container.video .column p { margin-top: 0; }
42
+
43
+ #content.contests .container.information .column.right .box { margin: 1em 0; }
44
+ #content.contests .container.information .column.right .box.videos .thumbnail img { width: 200px; height: 150px; margin-bottom: 5px; }
45
+ #content.contests .container.information .column.right .box.videos a:link, #content.contests .container.information .column.right .box.videos a:visited { color: #93d700; text-decoration: none; }
46
+ #content.contests .container.information .column.right .box.videos a:hover { text-decoration: underline; }
47
+ #content.contests .container.information .column.right .box.votes a { display: block; width: 200px; height: 60px; margin: 15px 0; background: url(/images/btn_votenow.gif) no-repeat; text-indent: -9999px; outline: none; border: none; }
48
+ #content.contests .container.information .column.right .box.votes h2 { margin: 52px 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
49
+
50
+ #content.contests .container.video .box.videos h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
51
+ #content.contests .container.video .box.videos table { width: 100; }
52
+ #content.contests .container.video .box.videos table td { padding: 1em; width: 25; vertical-align: top; }
53
+ #content.contests .container.video .box.videos table td p { margin: 0 0 5px 0; }
54
+ #content.contests .container.video .box.videos table td a:link, #content.contests .container.video .box.videos table td a:visited { color: #93d700; text-decoration: none; }
55
+ #content.contests .container.video .box.videos table td a:hover { text-decoration: underline; }
56
+ #content.contests .container.video .box.videos .thumbnail { float: left; }
57
+ #content.contests .container.video .box.videos .thumbnail img { width: 80px; height: 60px; margin: 0 10px 0 0; border: 1px solid #6e000d; }
58
+
59
+ #content .container.comments .column { margin-top: 15px; }
60
+ #content .container.comments .column.left { width: 600px; }
61
+ #content .container.comments .column.left .box ol { margin: 0; padding: 0; }
62
+ #content .container.comments .column.left .box li { list-style-type: none; padding: 10px; margin: 0 0 1em 0; background: #6e000d; border-top: 5px solid #a20013; }
63
+ #content .container.comments .column.left .box li div { margin-bottom: 1em; }
64
+ #content .container.comments .column.left .box li ul { text-align: right; }
65
+ #content .container.comments .column.left .box li ul li { display: inline; border: none; padding: 0; }; }
66
+ #content .container.comments .column.right { width: 290px; padding-left: 10px; }
67
+ #content .container.comments .column.right h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
68
+ #content .container.comments .column.right .box textarea { width: 290px; height: 100px; border: none; }
69
+
70
+ #footer { margin-top: 10px; padding: 1.2em 1.5em; background: #ff8500; }
71
+ #footer ul { margin: 0; padding: 0; list-style-type: none; }
72
+ #footer ul li { display: inline; margin: 0 0.5em; color: #440008; }
73
+ #footer ul.links { float: left; }
74
+ #footer ul.links a:link, #footer ul.links a:visited { color: #440008; text-decoration: none; }
75
+ #footer ul.links a:hover { text-decoration: underline; }
76
+ #footer ul.copyright { float: right; }
77
+
78
+ .clear { clear: both; }
79
+
80
+ .centered { text-align: center; }
81
+
82
+ img { border: none; }
83
+
84
+ button.short { width: 60px; height: 22px; padding: 0 0 2px 0; color: #fff; border: none; background: url(/images/btn_short.gif) no-repeat; }
85
+
86
+ table { border-collapse: collapse; }
@@ -0,0 +1,12 @@
1
+ #main { content: Hello!; qstr: Quo"ted"!; hstr: Hyph-en!; width: 30em; background-color: #000; color: #ffffaf; con: foo bar 9 hi there boom; con2: noquo quo; }
2
+ #main #sidebar { background-color: #00ff98; num-normal: 10; num-dec: 10.2; num-dec0: 99; num-neg: -10; esc: 10+12; many: 6; order: 7; complex: #4c9db1hi16; }
3
+
4
+ #plus { num-num: 7; num-num-un: 25em; num-num-un2: 23em; num-num-neg: 9.87; num-str: 100px; num-col: #bcbcbc; str-str: hi there; str-str2: hi there; str-col: 14em solid #1f2f3f; str-num: times: 13; col-num: #ff8aaa; col-col: #5f80ff; }
5
+
6
+ #minus { num-num: 900; col-num: #f9f9f4; col-col: #000035; }
7
+
8
+ #times { num-num: 7; num-col: #7496b8; col-num: #092345; col-col: #243648; }
9
+
10
+ #div { num-num: 3.33333333333333; num-num2: 3; col-num: #092345; col-col: #0b0d0f; }
11
+
12
+ #mod { num-num: 2; col-col: #0f0e05; col-num: #020001; }
@@ -0,0 +1,18 @@
1
+ #main {
2
+ width: 15em;
3
+ color: #0000ff;
4
+ }
5
+ #main p {
6
+ border-style: dotted;
7
+ border-width: 2px;
8
+ }
9
+ #main .cool {
10
+ width: 100px;
11
+ }
12
+
13
+ #left {
14
+ font-size: 2em;
15
+ font-weight: bold;
16
+
17
+ float: left;
18
+ }
@@ -0,0 +1,14 @@
1
+ #main {
2
+ width: 15em;
3
+ color: #0000ff; }
4
+ #main p {
5
+ border-style: dotted;
6
+ border-width: 2px; }
7
+ #main .cool {
8
+ width: 100px; }
9
+
10
+ #left {
11
+ font-size: 2em;
12
+ font-weight: bold;
13
+
14
+ float: left; }
@@ -0,0 +1,23 @@
1
+
2
+
3
+ body
4
+ :font Arial
5
+ :background blue
6
+
7
+ #page
8
+ :width 700px
9
+ :height 100
10
+ #header
11
+ :height 300px
12
+ h1
13
+ :font-size 50px
14
+ :color blue
15
+
16
+ #content.user.show
17
+ #container.top
18
+ #column.left
19
+ :width 100px
20
+ #column.right
21
+ :width 600px
22
+ #container.bottom
23
+ :background brown
@@ -0,0 +1,2 @@
1
+ bork
2
+ :bork= !bork
@@ -0,0 +1,15 @@
1
+ #main
2
+ :width 15em
3
+ :color #0000ff
4
+ p
5
+ :border
6
+ :style dotted
7
+ :width 2px
8
+ .cool
9
+ :width 100px
10
+
11
+ #left
12
+ :font
13
+ :size 2em
14
+ :weight bold
15
+ :float left
@@ -0,0 +1,291 @@
1
+ body
2
+ :margin 0
3
+ :font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif
4
+ :color #fff
5
+ :background url(/images/global_bg.gif)
6
+
7
+ #page
8
+ :width 900px
9
+ :margin 0 auto
10
+ :background #440008
11
+ :border-top
12
+ :width 5px
13
+ :style solid
14
+ :color #ff8500
15
+
16
+ #header
17
+ :height 75px
18
+ :padding 0
19
+ h1
20
+ :float left
21
+ :width 274px
22
+ :height 75px
23
+ :margin 0
24
+ :background
25
+ :image url(/images/global_logo.gif)
26
+ :repeat no-repeat
27
+ :text-indent -9999px
28
+ .status
29
+ :float right
30
+ :padding
31
+ :top .5em
32
+ :left .5em
33
+ :right .5em
34
+ :bottom 0
35
+ p
36
+ :float left
37
+ :margin
38
+ :top 0
39
+ :right 0.5em
40
+ :bottom 0
41
+ :left 0
42
+ ul
43
+ :float left
44
+ :margin 0
45
+ :padding 0
46
+ li
47
+ :list-style-type none
48
+ :display inline
49
+ :margin 0 5px
50
+ a:link, a:visited
51
+ :color #ff8500
52
+ :text-decoration none
53
+ a:hover
54
+ :text-decoration underline
55
+ .search
56
+ :float right
57
+ :clear right
58
+ :margin 12px 0 0 0
59
+ form
60
+ :margin 0
61
+ input
62
+ :margin 0 3px 0 0
63
+ :padding 2px
64
+ :border none
65
+
66
+ #menu
67
+ :clear both
68
+ :text-align right
69
+ :height 20px
70
+ :border-bottom 5px solid #006b95
71
+ :background #00a4e4
72
+ .contests
73
+ ul
74
+ :margin 0 5px 0 0
75
+ :padding 0
76
+ li
77
+ :list-style-type none
78
+ :margin 0 5px
79
+ :padding 5px 5px 0 5px
80
+ :display inline
81
+ :font-size 1.1em
82
+ :color #fff
83
+ :background #00a4e4
84
+ a:link, a:visited
85
+ :color #fff
86
+ :text-decoration none
87
+ :font-weight bold
88
+ a:hover
89
+ :text-decoration underline
90
+
91
+ //General content information
92
+ #content
93
+ :clear both
94
+ .container
95
+ :clear both
96
+ .column
97
+ :float left
98
+ .left
99
+ .middle
100
+ .right
101
+ :float right
102
+ a:link, a:visited
103
+ :color #93d700
104
+ :text-decoration none
105
+ a:hover
106
+ :text-decoration underline
107
+
108
+ #content
109
+ p, div
110
+ :width 40em
111
+ li, dt, dd
112
+ :color #ddffdd
113
+ :background-color #4792bb
114
+ .container.video
115
+ .column.left
116
+ :width 200px
117
+ .box
118
+ :margin-top 10px
119
+ p
120
+ :margin 0 1em auto 1em
121
+ .box.participants
122
+ img
123
+ :float left
124
+ :margin 0 1em auto 1em
125
+ :border 1px solid #6e000d
126
+ h2
127
+ :margin 0 0 10px 0
128
+ :padding 0.5em
129
+ :background #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat
130
+ :text-indent -9999px
131
+ :border
132
+ :top
133
+ :width 5px
134
+ :style solid
135
+ :color #a20013
136
+ :right
137
+ :width 1px
138
+ :style dotted
139
+ .column.middle
140
+ :width 500px
141
+ .column.right
142
+ :width 200px
143
+ .box
144
+ :margin-top 0
145
+ p
146
+ :margin 0 1em auto 1em
147
+ .column
148
+ p
149
+ :margin-top 0
150
+
151
+ #content.contests
152
+ .container.information
153
+ .column.right
154
+ .box
155
+ :margin 1em 0
156
+ .box.videos
157
+ .thumbnail img
158
+ :width 200px
159
+ :height 150px
160
+ :margin-bottom 5px
161
+ a:link, a:visited
162
+ :color #93d700
163
+ :text-decoration none
164
+ a:hover
165
+ :text-decoration underline
166
+ .box.votes
167
+ a
168
+ :display block
169
+ :width 200px
170
+ :height 60px
171
+ :margin 15px 0
172
+ :background url(/images/btn_votenow.gif) no-repeat
173
+ :text-indent -9999px
174
+ :outline none
175
+ :border none
176
+ h2
177
+ :margin 52px 0 10px 0
178
+ :padding 0.5em
179
+ :background #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat
180
+ :text-indent -9999px
181
+ :border-top 5px solid #a20013
182
+
183
+ #content.contests
184
+ .container.video
185
+ .box.videos
186
+ h2
187
+ :margin 0
188
+ :padding 0.5em
189
+ :background #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat
190
+ :text-indent -9999px
191
+ :border-top 5px solid #a20013
192
+ table
193
+ :width 100
194
+ td
195
+ :padding 1em
196
+ :width 25
197
+ :vertical-align top
198
+ p
199
+ :margin 0 0 5px 0
200
+ a:link, a:visited
201
+ :color #93d700
202
+ :text-decoration none
203
+ a:hover
204
+ :text-decoration underline
205
+ .thumbnail
206
+ :float left
207
+ img
208
+ :width 80px
209
+ :height 60px
210
+ :margin 0 10px 0 0
211
+ :border 1px solid #6e000d
212
+
213
+ #content
214
+ .container.comments
215
+ .column
216
+ :margin-top 15px
217
+ .column.left
218
+ :width 600px
219
+ .box
220
+ ol
221
+ :margin 0
222
+ :padding 0
223
+ li
224
+ :list-style-type none
225
+ :padding 10px
226
+ :margin 0 0 1em 0
227
+ :background #6e000d
228
+ :border-top 5px solid #a20013
229
+ div
230
+ :margin-bottom 1em
231
+ ul
232
+ :text-align right
233
+ li
234
+ :display inline; border: none; padding: 0; }
235
+ .column.right
236
+ :width 290px
237
+ :padding-left 10px
238
+ h2
239
+ :margin 0
240
+ :padding 0.5em
241
+ :background #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat
242
+ :text-indent -9999px
243
+ :border-top 5px solid #a20013
244
+ .box
245
+ textarea
246
+ :width 290px
247
+ :height 100px
248
+ :border none
249
+
250
+ #footer
251
+ :margin-top 10px
252
+ :padding 1.2em 1.5em
253
+ :background #ff8500
254
+ ul
255
+ :margin 0
256
+ :padding 0
257
+ :list-style-type none
258
+ li
259
+ :display inline
260
+ :margin 0 0.5em
261
+ :color #440008
262
+ ul.links
263
+ :float left
264
+ a:link, a:visited
265
+ :color #440008
266
+ :text-decoration none
267
+ a:hover
268
+ :text-decoration underline
269
+ ul.copyright
270
+ :float right
271
+
272
+
273
+ .clear
274
+ :clear both
275
+
276
+ .centered
277
+ :text-align center
278
+
279
+ img
280
+ :border none
281
+
282
+ button.short
283
+ :width 60px
284
+ :height 22px
285
+ :padding 0 0 2px 0
286
+ :color #fff
287
+ :border none
288
+ :background url(/images/btn_short.gif) no-repeat
289
+
290
+ table
291
+ :border-collapse collapse