haml 4.0.7 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/CHANGELOG.md +42 -4
- data/FAQ.md +4 -14
- data/MIT-LICENSE +1 -1
- data/README.md +85 -42
- data/REFERENCE.md +108 -57
- data/Rakefile +46 -54
- data/lib/haml/attribute_builder.rb +163 -0
- data/lib/haml/attribute_compiler.rb +215 -0
- data/lib/haml/attribute_parser.rb +144 -0
- data/lib/haml/buffer.rb +22 -132
- data/lib/haml/compiler.rb +87 -295
- data/lib/haml/engine.rb +25 -41
- data/lib/haml/error.rb +3 -0
- data/lib/haml/escapable.rb +49 -0
- data/lib/haml/exec.rb +33 -19
- data/lib/haml/filters.rb +18 -24
- data/lib/haml/generator.rb +41 -0
- data/lib/haml/helpers/action_view_extensions.rb +3 -2
- data/lib/haml/helpers/action_view_mods.rb +36 -58
- data/lib/haml/helpers/action_view_xss_mods.rb +1 -0
- data/lib/haml/helpers/safe_erubi_template.rb +27 -0
- data/lib/haml/helpers/safe_erubis_template.rb +4 -1
- data/lib/haml/helpers/xss_mods.rb +18 -12
- data/lib/haml/helpers.rb +133 -90
- data/lib/haml/options.rb +38 -47
- data/lib/haml/parser.rb +278 -216
- data/lib/haml/{template/plugin.rb → plugin.rb} +8 -15
- data/lib/haml/railtie.rb +21 -12
- data/lib/haml/sass_rails_filter.rb +17 -4
- data/lib/haml/template/options.rb +12 -2
- data/lib/haml/template.rb +12 -6
- data/lib/haml/temple_engine.rb +120 -0
- data/lib/haml/temple_line_counter.rb +29 -0
- data/lib/haml/util.rb +80 -199
- data/lib/haml/version.rb +2 -1
- data/lib/haml.rb +1 -0
- data/test/attribute_parser_test.rb +101 -0
- data/test/engine_test.rb +287 -176
- data/test/filters_test.rb +32 -19
- data/test/gemfiles/Gemfile.rails-4.0.x +9 -3
- data/test/gemfiles/Gemfile.rails-4.0.x.lock +87 -0
- data/test/gemfiles/Gemfile.rails-4.1.x +5 -0
- data/test/gemfiles/Gemfile.rails-4.2.x +5 -0
- data/test/gemfiles/Gemfile.rails-5.0.x +4 -0
- data/test/helper_test.rb +224 -112
- data/test/options_test.rb +22 -0
- data/test/parser_test.rb +71 -4
- data/test/results/bemit.xhtml +4 -0
- data/test/results/eval_suppressed.xhtml +4 -4
- data/test/results/helpers.xhtml +43 -41
- data/test/results/helpful.xhtml +6 -3
- data/test/results/just_stuff.xhtml +21 -20
- data/test/results/list.xhtml +9 -9
- data/test/results/nuke_inner_whitespace.xhtml +22 -22
- data/test/results/nuke_outer_whitespace.xhtml +84 -92
- data/test/results/original_engine.xhtml +17 -17
- data/test/results/partial_layout.xhtml +4 -3
- data/test/results/partial_layout_erb.xhtml +4 -3
- data/test/results/partials.xhtml +11 -10
- data/test/results/silent_script.xhtml +63 -63
- data/test/results/standard.xhtml +156 -159
- data/test/results/tag_parsing.xhtml +19 -19
- data/test/results/very_basic.xhtml +2 -2
- data/test/results/whitespace_handling.xhtml +77 -76
- data/test/template_test.rb +24 -56
- data/test/template_test_helper.rb +38 -0
- data/test/templates/bemit.haml +3 -0
- data/test/templates/just_stuff.haml +1 -0
- data/test/templates/standard_ugly.haml +1 -0
- data/test/templates/with_bom.haml +1 -0
- data/test/temple_line_counter_test.rb +40 -0
- data/test/test_helper.rb +26 -8
- data/test/util_test.rb +6 -47
- metadata +53 -43
- data/test/gemfiles/Gemfile.rails-3.0.x +0 -5
- data/test/gemfiles/Gemfile.rails-3.1.x +0 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +0 -5
- data/test/haml-spec/LICENSE +0 -14
- data/test/haml-spec/README.md +0 -106
- data/test/haml-spec/lua_haml_spec.lua +0 -38
- data/test/haml-spec/perl_haml_test.pl +0 -81
- data/test/haml-spec/ruby_haml_test.rb +0 -23
- data/test/haml-spec/tests.json +0 -660
- data/test/templates/_av_partial_1_ugly.haml +0 -9
- data/test/templates/_av_partial_2_ugly.haml +0 -5
- data/test/templates/action_view_ugly.haml +0 -47
- data/test/templates/standard_ugly.haml +0 -43
data/test/haml-spec/tests.json
DELETED
@@ -1,660 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"headers" : {
|
3
|
-
|
4
|
-
"an XHTML XML prolog" : {
|
5
|
-
"haml" : "!!! XML",
|
6
|
-
"html" : "<?xml version='1.0' encoding='utf-8' ?>",
|
7
|
-
"config" : {
|
8
|
-
"format" : "xhtml"
|
9
|
-
}
|
10
|
-
},
|
11
|
-
|
12
|
-
"an XHTML default (transitional) doctype" : {
|
13
|
-
"haml" : "!!!",
|
14
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
|
15
|
-
"config" : {
|
16
|
-
"format" : "xhtml"
|
17
|
-
}
|
18
|
-
},
|
19
|
-
|
20
|
-
"an XHTML 1.1 doctype" : {
|
21
|
-
"haml" : "!!! 1.1",
|
22
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">",
|
23
|
-
"config" : {
|
24
|
-
"format" : "xhtml"
|
25
|
-
}
|
26
|
-
},
|
27
|
-
|
28
|
-
"an XHTML 1.2 mobile doctype" : {
|
29
|
-
"haml" : "!!! mobile",
|
30
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">",
|
31
|
-
"config" : {
|
32
|
-
"format" : "xhtml"
|
33
|
-
}
|
34
|
-
},
|
35
|
-
|
36
|
-
"an XHTML 1.1 basic doctype" : {
|
37
|
-
"haml" : "!!! basic",
|
38
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">",
|
39
|
-
"config" : {
|
40
|
-
"format" : "xhtml"
|
41
|
-
}
|
42
|
-
},
|
43
|
-
|
44
|
-
"an XHTML 1.0 frameset doctype" : {
|
45
|
-
"haml" : "!!! frameset",
|
46
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">",
|
47
|
-
"config" : {
|
48
|
-
"format" : "xhtml"
|
49
|
-
}
|
50
|
-
},
|
51
|
-
|
52
|
-
"an HTML 5 doctype with XHTML syntax" : {
|
53
|
-
"haml" : "!!! 5",
|
54
|
-
"html" : "<!DOCTYPE html>",
|
55
|
-
"config" : {
|
56
|
-
"format" : "xhtml"
|
57
|
-
}
|
58
|
-
},
|
59
|
-
|
60
|
-
"an HTML 5 XML prolog (silent)" : {
|
61
|
-
"haml" : "!!! XML",
|
62
|
-
"html" : "",
|
63
|
-
"config" : {
|
64
|
-
"format" : "html5"
|
65
|
-
}
|
66
|
-
},
|
67
|
-
|
68
|
-
"an HTML 5 doctype" : {
|
69
|
-
"haml" : "!!!",
|
70
|
-
"html" : "<!DOCTYPE html>",
|
71
|
-
"config" : {
|
72
|
-
"format" : "html5"
|
73
|
-
}
|
74
|
-
},
|
75
|
-
|
76
|
-
"an HTML 4 XML prolog (silent)" : {
|
77
|
-
"haml" : "!!! XML",
|
78
|
-
"html" : "",
|
79
|
-
"config" : {
|
80
|
-
"format" : "html4"
|
81
|
-
}
|
82
|
-
},
|
83
|
-
|
84
|
-
"an HTML 4 default (transitional) doctype" : {
|
85
|
-
"haml" : "!!!",
|
86
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
|
87
|
-
"config" : {
|
88
|
-
"format" : "html4"
|
89
|
-
}
|
90
|
-
},
|
91
|
-
|
92
|
-
"an HTML 4 frameset doctype" : {
|
93
|
-
"haml" : "!!! frameset",
|
94
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
|
95
|
-
"config" : {
|
96
|
-
"format" : "html4"
|
97
|
-
}
|
98
|
-
},
|
99
|
-
|
100
|
-
"an HTML 4 strict doctype" : {
|
101
|
-
"haml" : "!!! strict",
|
102
|
-
"html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">",
|
103
|
-
"config" : {
|
104
|
-
"format" : "html4"
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
},
|
109
|
-
|
110
|
-
"basic Haml tags and CSS": {
|
111
|
-
|
112
|
-
"a simple Haml tag" : {
|
113
|
-
"haml" : "%p",
|
114
|
-
"html" : "<p></p>"
|
115
|
-
},
|
116
|
-
|
117
|
-
"a self-closing tag (XHTML)" : {
|
118
|
-
"haml" : "%meta",
|
119
|
-
"html" : "<meta />",
|
120
|
-
"config" : {
|
121
|
-
"format" : "xhtml"
|
122
|
-
}
|
123
|
-
},
|
124
|
-
|
125
|
-
"a self-closing tag (HTML4)" : {
|
126
|
-
"haml" : "%meta",
|
127
|
-
"html" : "<meta>",
|
128
|
-
"config" : {
|
129
|
-
"format" : "html4"
|
130
|
-
}
|
131
|
-
},
|
132
|
-
|
133
|
-
"a self-closing tag (HTML5)" : {
|
134
|
-
"haml" : "%meta",
|
135
|
-
"html" : "<meta>",
|
136
|
-
"config" : {
|
137
|
-
"format" : "html5"
|
138
|
-
}
|
139
|
-
},
|
140
|
-
|
141
|
-
"a self-closing tag ('/' modifier + XHTML)" : {
|
142
|
-
"haml" : "%zzz/",
|
143
|
-
"html" : "<zzz />",
|
144
|
-
"config" : {
|
145
|
-
"format" : "xhtml"
|
146
|
-
}
|
147
|
-
},
|
148
|
-
|
149
|
-
"a self-closing tag ('/' modifier + HTML5)" : {
|
150
|
-
"haml" : "%zzz/",
|
151
|
-
"html" : "<zzz>",
|
152
|
-
"config" : {
|
153
|
-
"format" : "html5"
|
154
|
-
}
|
155
|
-
},
|
156
|
-
|
157
|
-
"a tag with a CSS class" : {
|
158
|
-
"haml" : "%p.class1",
|
159
|
-
"html" : "<p class='class1'></p>"
|
160
|
-
},
|
161
|
-
|
162
|
-
"a tag with multiple CSS classes" : {
|
163
|
-
"haml" : "%p.class1.class2",
|
164
|
-
"html" : "<p class='class1 class2'></p>"
|
165
|
-
},
|
166
|
-
|
167
|
-
"a tag with a CSS id" : {
|
168
|
-
"haml" : "%p#id1",
|
169
|
-
"html" : "<p id='id1'></p>"
|
170
|
-
},
|
171
|
-
|
172
|
-
"a tag with multiple CSS id's" : {
|
173
|
-
"haml" : "%p#id1#id2",
|
174
|
-
"html" : "<p id='id2'></p>"
|
175
|
-
},
|
176
|
-
|
177
|
-
"a tag with a class followed by an id" : {
|
178
|
-
"haml" : "%p.class1#id1",
|
179
|
-
"html" : "<p class='class1' id='id1'></p>"
|
180
|
-
},
|
181
|
-
|
182
|
-
"a tag with an id followed by a class" : {
|
183
|
-
"haml" : "%p#id1.class1",
|
184
|
-
"html" : "<p class='class1' id='id1'></p>"
|
185
|
-
},
|
186
|
-
|
187
|
-
"an implicit div with a CSS id" : {
|
188
|
-
"haml" : "#id1",
|
189
|
-
"html" : "<div id='id1'></div>"
|
190
|
-
},
|
191
|
-
|
192
|
-
"an implicit div with a CSS class" : {
|
193
|
-
"haml" : ".class1",
|
194
|
-
"html" : "<div class='class1'></div>"
|
195
|
-
},
|
196
|
-
|
197
|
-
"multiple simple Haml tags" : {
|
198
|
-
"haml" : "%div\n %div\n %p",
|
199
|
-
"html" : "<div>\n <div>\n <p></p>\n </div>\n</div>"
|
200
|
-
}
|
201
|
-
},
|
202
|
-
|
203
|
-
"tags with unusual HTML characters" : {
|
204
|
-
|
205
|
-
"a tag with colons" : {
|
206
|
-
"haml" : "%ns:tag",
|
207
|
-
"html" : "<ns:tag></ns:tag>"
|
208
|
-
},
|
209
|
-
|
210
|
-
"a tag with underscores" : {
|
211
|
-
"haml" : "%snake_case",
|
212
|
-
"html" : "<snake_case></snake_case>"
|
213
|
-
},
|
214
|
-
|
215
|
-
"a tag with dashes" : {
|
216
|
-
"haml" : "%dashed-tag",
|
217
|
-
"html" : "<dashed-tag></dashed-tag>"
|
218
|
-
},
|
219
|
-
|
220
|
-
"a tag with camelCase" : {
|
221
|
-
"haml" : "%camelCase",
|
222
|
-
"html" : "<camelCase></camelCase>"
|
223
|
-
},
|
224
|
-
|
225
|
-
"a tag with PascalCase" : {
|
226
|
-
"haml" : "%PascalCase",
|
227
|
-
"html" : "<PascalCase></PascalCase>"
|
228
|
-
}
|
229
|
-
},
|
230
|
-
|
231
|
-
"tags with unusual CSS identifiers" : {
|
232
|
-
|
233
|
-
"an all-numeric class" : {
|
234
|
-
"haml" : ".123",
|
235
|
-
"html" : "<div class='123'></div>"
|
236
|
-
},
|
237
|
-
|
238
|
-
"a class with underscores" : {
|
239
|
-
"haml" : ".__",
|
240
|
-
"html" : "<div class='__'></div>"
|
241
|
-
},
|
242
|
-
|
243
|
-
"a class with dashes" : {
|
244
|
-
"haml" : ".--",
|
245
|
-
"html" : "<div class='--'></div>"
|
246
|
-
}
|
247
|
-
},
|
248
|
-
|
249
|
-
"tags with inline content" : {
|
250
|
-
|
251
|
-
"Inline content simple tag" : {
|
252
|
-
"haml" : "%p hello",
|
253
|
-
"html" : "<p>hello</p>"
|
254
|
-
},
|
255
|
-
|
256
|
-
"Inline content tag with CSS" : {
|
257
|
-
"haml" : "%p.class1 hello",
|
258
|
-
"html" : "<p class='class1'>hello</p>"
|
259
|
-
},
|
260
|
-
|
261
|
-
"Inline content multiple simple tags" : {
|
262
|
-
"haml" : "%div\n %div\n %p text",
|
263
|
-
"html" : "<div>\n <div>\n <p>text</p>\n </div>\n</div>"
|
264
|
-
}
|
265
|
-
},
|
266
|
-
|
267
|
-
"tags with nested content" : {
|
268
|
-
|
269
|
-
"Nested content simple tag" : {
|
270
|
-
"haml" : "%p\n hello",
|
271
|
-
"html" : "<p>\n hello\n</p>"
|
272
|
-
},
|
273
|
-
|
274
|
-
"Nested content tag with CSS" : {
|
275
|
-
"haml" : "%p.class1\n hello",
|
276
|
-
"html" : "<p class='class1'>\n hello\n</p>"
|
277
|
-
},
|
278
|
-
|
279
|
-
"Nested content multiple simple tags" : {
|
280
|
-
"haml" : "%div\n %div\n %p\n text",
|
281
|
-
"html" : "<div>\n <div>\n <p>\n text\n </p>\n </div>\n</div>"
|
282
|
-
}
|
283
|
-
},
|
284
|
-
|
285
|
-
"tags with HTML-style attributes": {
|
286
|
-
|
287
|
-
"HTML-style one attribute" : {
|
288
|
-
"haml" : "%p(a='b')",
|
289
|
-
"html" : "<p a='b'></p>"
|
290
|
-
},
|
291
|
-
|
292
|
-
"HTML-style multiple attributes" : {
|
293
|
-
"haml" : "%p(a='b' c='d')",
|
294
|
-
"html" : "<p a='b' c='d'></p>"
|
295
|
-
},
|
296
|
-
|
297
|
-
"HTML-style attributes separated with newlines" : {
|
298
|
-
"haml" : "%p(a='b'\n c='d')",
|
299
|
-
"html" : "<p a='b' c='d'></p>"
|
300
|
-
},
|
301
|
-
|
302
|
-
"HTML-style interpolated attribute" : {
|
303
|
-
"haml" : "%p(a=\"#{var}\")",
|
304
|
-
"html" : "<p a='value'></p>",
|
305
|
-
"locals" : {
|
306
|
-
"var" : "value"
|
307
|
-
}
|
308
|
-
},
|
309
|
-
|
310
|
-
"HTML-style 'class' as an attribute" : {
|
311
|
-
"haml" : "%p(class='class1')",
|
312
|
-
"html" : "<p class='class1'></p>"
|
313
|
-
},
|
314
|
-
|
315
|
-
"HTML-style tag with a CSS class and 'class' as an attribute" : {
|
316
|
-
"haml" : "%p.class2(class='class1')",
|
317
|
-
"html" : "<p class='class1 class2'></p>"
|
318
|
-
},
|
319
|
-
|
320
|
-
"HTML-style tag with 'id' as an attribute" : {
|
321
|
-
"haml" : "%p(id='1')",
|
322
|
-
"html" : "<p id='1'></p>"
|
323
|
-
},
|
324
|
-
|
325
|
-
"HTML-style tag with a CSS id and 'id' as an attribute" : {
|
326
|
-
"haml" : "%p#id(id='1')",
|
327
|
-
"html" : "<p id='id_1'></p>"
|
328
|
-
},
|
329
|
-
|
330
|
-
"HTML-style tag with a variable attribute" : {
|
331
|
-
"haml" : "%p(class=var)",
|
332
|
-
"html" : "<p class='hello'></p>",
|
333
|
-
"locals" : {
|
334
|
-
"var" : "hello"
|
335
|
-
}
|
336
|
-
},
|
337
|
-
|
338
|
-
"HTML-style tag with a CSS class and 'class' as a variable attribute" : {
|
339
|
-
"haml" : ".hello(class=var)",
|
340
|
-
"html" : "<div class='hello world'></div>",
|
341
|
-
"locals" : {
|
342
|
-
"var" : "world"
|
343
|
-
}
|
344
|
-
},
|
345
|
-
|
346
|
-
"HTML-style tag multiple CSS classes (sorted correctly)" : {
|
347
|
-
"haml" : ".z(class=var)",
|
348
|
-
"html" : "<div class='a z'></div>",
|
349
|
-
"locals" : {
|
350
|
-
"var" : "a"
|
351
|
-
}
|
352
|
-
}
|
353
|
-
},
|
354
|
-
|
355
|
-
"tags with Ruby-style attributes": {
|
356
|
-
|
357
|
-
"Ruby-style one attribute" : {
|
358
|
-
"haml" : "%p{:a => 'b'}",
|
359
|
-
"html" : "<p a='b'></p>",
|
360
|
-
"optional" : true
|
361
|
-
},
|
362
|
-
|
363
|
-
"Ruby-style attributes hash with whitespace" : {
|
364
|
-
"haml" : "%p{ :a => 'b' }",
|
365
|
-
"html" : "<p a='b'></p>",
|
366
|
-
"optional" : true
|
367
|
-
},
|
368
|
-
|
369
|
-
"Ruby-style interpolated attribute" : {
|
370
|
-
"haml" : "%p{:a =>\"#{var}\"}",
|
371
|
-
"html" : "<p a='value'></p>",
|
372
|
-
"optional" : true,
|
373
|
-
"locals" : {
|
374
|
-
"var" : "value"
|
375
|
-
}
|
376
|
-
},
|
377
|
-
|
378
|
-
"Ruby-style multiple attributes" : {
|
379
|
-
"haml" : "%p{ :a => 'b', 'c' => 'd' }",
|
380
|
-
"html" : "<p a='b' c='d'></p>",
|
381
|
-
"optional" : true
|
382
|
-
},
|
383
|
-
|
384
|
-
"Ruby-style attributes separated with newlines" : {
|
385
|
-
"haml" : "%p{ :a => 'b',\n 'c' => 'd' }",
|
386
|
-
"html" : "<p a='b' c='d'></p>",
|
387
|
-
"optional" : true
|
388
|
-
},
|
389
|
-
|
390
|
-
"Ruby-style 'class' as an attribute" : {
|
391
|
-
"haml" : "%p{:class => 'class1'}",
|
392
|
-
"html" : "<p class='class1'></p>",
|
393
|
-
"optional" : true
|
394
|
-
},
|
395
|
-
|
396
|
-
"Ruby-style tag with a CSS class and 'class' as an attribute" : {
|
397
|
-
"haml" : "%p.class2{:class => 'class1'}",
|
398
|
-
"html" : "<p class='class1 class2'></p>",
|
399
|
-
"optional" : true
|
400
|
-
},
|
401
|
-
|
402
|
-
"Ruby-style tag with 'id' as an attribute" : {
|
403
|
-
"haml" : "%p{:id => '1'}",
|
404
|
-
"html" : "<p id='1'></p>",
|
405
|
-
"optional" : true
|
406
|
-
},
|
407
|
-
|
408
|
-
"Ruby-style tag with a CSS id and 'id' as an attribute" : {
|
409
|
-
"haml" : "%p#id{:id => '1'}",
|
410
|
-
"html" : "<p id='id_1'></p>",
|
411
|
-
"optional" : true
|
412
|
-
},
|
413
|
-
|
414
|
-
"Ruby-style tag with a CSS id and a numeric 'id' as an attribute" : {
|
415
|
-
"haml" : "%p#id{:id => 1}",
|
416
|
-
"html" : "<p id='id_1'></p>",
|
417
|
-
"optional" : true
|
418
|
-
},
|
419
|
-
|
420
|
-
"Ruby-style tag with a variable attribute" : {
|
421
|
-
"haml" : "%p{:class => var}",
|
422
|
-
"html" : "<p class='hello'></p>",
|
423
|
-
"optional" : true,
|
424
|
-
"locals" : {
|
425
|
-
"var" : "hello"
|
426
|
-
}
|
427
|
-
},
|
428
|
-
|
429
|
-
"Ruby-style tag with a CSS class and 'class' as a variable attribute" : {
|
430
|
-
"haml" : ".hello{:class => var}",
|
431
|
-
"html" : "<div class='hello world'></div>",
|
432
|
-
"optional" : true,
|
433
|
-
"locals" : {
|
434
|
-
"var" : "world"
|
435
|
-
}
|
436
|
-
},
|
437
|
-
|
438
|
-
"Ruby-style tag multiple CSS classes (sorted correctly)" : {
|
439
|
-
"haml" : ".z{:class => var}",
|
440
|
-
"html" : "<div class='a z'></div>",
|
441
|
-
"optional" : true,
|
442
|
-
"locals" : {
|
443
|
-
"var" : "a"
|
444
|
-
}
|
445
|
-
}
|
446
|
-
},
|
447
|
-
|
448
|
-
"silent comments" : {
|
449
|
-
|
450
|
-
"an inline silent comment" : {
|
451
|
-
"haml" : "-# hello",
|
452
|
-
"html" : ""
|
453
|
-
},
|
454
|
-
|
455
|
-
"a nested silent comment" : {
|
456
|
-
"haml" : "-#\n hello",
|
457
|
-
"html" : ""
|
458
|
-
},
|
459
|
-
|
460
|
-
"a multiply nested silent comment" : {
|
461
|
-
"haml" : "-#\n %div\n foo",
|
462
|
-
"html" : ""
|
463
|
-
},
|
464
|
-
|
465
|
-
"a multiply nested silent comment with inconsistent indents" : {
|
466
|
-
"haml" : "-#\n %div\n foo",
|
467
|
-
"html" : ""
|
468
|
-
}
|
469
|
-
},
|
470
|
-
|
471
|
-
"markup comments" : {
|
472
|
-
|
473
|
-
"an inline markup comment" : {
|
474
|
-
"haml" : "/ comment",
|
475
|
-
"html" : "<!-- comment -->"
|
476
|
-
},
|
477
|
-
|
478
|
-
"a nested markup comment" : {
|
479
|
-
"haml" : "/\n comment\n comment2",
|
480
|
-
"html" : "<!--\n comment\n comment2\n-->"
|
481
|
-
}
|
482
|
-
},
|
483
|
-
|
484
|
-
"conditional comments": {
|
485
|
-
"a conditional comment" : {
|
486
|
-
"haml" : "/[if IE]\n %p a",
|
487
|
-
"html" : "<!--[if IE]>\n <p>a</p>\n<![endif]-->"
|
488
|
-
}
|
489
|
-
},
|
490
|
-
|
491
|
-
"internal filters": {
|
492
|
-
|
493
|
-
"content in an 'escaped' filter" : {
|
494
|
-
"haml" : ":escaped\n <&\">",
|
495
|
-
"html" : "<&">"
|
496
|
-
},
|
497
|
-
|
498
|
-
"content in a 'preserve' filter" : {
|
499
|
-
"haml" : ":preserve\n hello\n\n%p",
|
500
|
-
"html" : "hello
\n<p></p>"
|
501
|
-
},
|
502
|
-
|
503
|
-
"content in a 'plain' filter" : {
|
504
|
-
"haml" : ":plain\n hello\n\n%p",
|
505
|
-
"html" : "hello\n<p></p>"
|
506
|
-
},
|
507
|
-
|
508
|
-
"content in a 'css' filter (XHTML)" : {
|
509
|
-
"haml" : ":css\n hello\n\n%p",
|
510
|
-
"html" : "<style type='text/css'>\n /*<![CDATA[*/\n hello\n /*]]>*/\n</style>\n<p></p>",
|
511
|
-
"config" : {
|
512
|
-
"format" : "xhtml"
|
513
|
-
}
|
514
|
-
},
|
515
|
-
|
516
|
-
"content in a 'javascript' filter (XHTML)" : {
|
517
|
-
"haml" : ":javascript\n a();\n%p",
|
518
|
-
"html" : "<script type='text/javascript'>\n //<![CDATA[\n a();\n //]]>\n</script>\n<p></p>",
|
519
|
-
"config" : {
|
520
|
-
"format" : "xhtml"
|
521
|
-
}
|
522
|
-
},
|
523
|
-
|
524
|
-
"content in a 'css' filter (HTML)" : {
|
525
|
-
"haml" : ":css\n hello\n\n%p",
|
526
|
-
"html" : "<style>\n hello\n</style>\n<p></p>",
|
527
|
-
"config" : {
|
528
|
-
"format" : "html5"
|
529
|
-
}
|
530
|
-
},
|
531
|
-
|
532
|
-
"content in a 'javascript' filter (HTML)" : {
|
533
|
-
"haml" : ":javascript\n a();\n%p",
|
534
|
-
"html" : "<script>\n a();\n</script>\n<p></p>",
|
535
|
-
"config" : {
|
536
|
-
"format" : "html5"
|
537
|
-
}
|
538
|
-
}
|
539
|
-
},
|
540
|
-
|
541
|
-
"Ruby-style interpolation": {
|
542
|
-
|
543
|
-
"interpolation inside inline content" : {
|
544
|
-
"haml" : "%p #{var}",
|
545
|
-
"html" : "<p>value</p>",
|
546
|
-
"optional" : true,
|
547
|
-
"locals" : {
|
548
|
-
"var" : "value"
|
549
|
-
}
|
550
|
-
},
|
551
|
-
|
552
|
-
"no interpolation when escaped" : {
|
553
|
-
"haml" : "%p \\#{var}",
|
554
|
-
"html" : "<p>#{var}</p>",
|
555
|
-
"optional" : true,
|
556
|
-
"locals" : {
|
557
|
-
"var" : "value"
|
558
|
-
}
|
559
|
-
},
|
560
|
-
|
561
|
-
"interpolation when the escape character is escaped" : {
|
562
|
-
"haml" : "%p \\\\#{var}",
|
563
|
-
"html" : "<p>\\value</p>",
|
564
|
-
"optional" : true,
|
565
|
-
"locals" : {
|
566
|
-
"var" : "value"
|
567
|
-
}
|
568
|
-
},
|
569
|
-
|
570
|
-
"interpolation inside filtered content" : {
|
571
|
-
"haml" : ":plain\n #{var} interpolated: #{var}",
|
572
|
-
"html" : "value interpolated: value",
|
573
|
-
"optional" : true,
|
574
|
-
"locals" : {
|
575
|
-
"var" : "value"
|
576
|
-
}
|
577
|
-
}
|
578
|
-
},
|
579
|
-
|
580
|
-
"HTML escaping" : {
|
581
|
-
|
582
|
-
"code following '&='" : {
|
583
|
-
"haml" : "&= '<\"&>'",
|
584
|
-
"html" : "<"&>"
|
585
|
-
},
|
586
|
-
|
587
|
-
"code following '=' when escape_haml is set to true" : {
|
588
|
-
"haml" : "= '<\"&>'",
|
589
|
-
"html" : "<"&>",
|
590
|
-
"config" : {
|
591
|
-
"escape_html" : "true"
|
592
|
-
}
|
593
|
-
},
|
594
|
-
|
595
|
-
"code following '!=' when escape_haml is set to true" : {
|
596
|
-
"haml" : "!= '<\"&>'",
|
597
|
-
"html" : "<\"&>",
|
598
|
-
"config" : {
|
599
|
-
"escape_html" : "true"
|
600
|
-
}
|
601
|
-
}
|
602
|
-
|
603
|
-
},
|
604
|
-
|
605
|
-
"boolean attributes" : {
|
606
|
-
|
607
|
-
"boolean attribute with XHTML" : {
|
608
|
-
"haml" : "%input(checked=true)",
|
609
|
-
"html" : "<input checked='checked' />",
|
610
|
-
"config" : {
|
611
|
-
"format" : "xhtml"
|
612
|
-
}
|
613
|
-
},
|
614
|
-
|
615
|
-
"boolean attribute with HTML" : {
|
616
|
-
"haml" : "%input(checked=true)",
|
617
|
-
"html" : "<input checked>",
|
618
|
-
"config" : {
|
619
|
-
"format" : "html5"
|
620
|
-
}
|
621
|
-
}
|
622
|
-
},
|
623
|
-
|
624
|
-
"whitespace preservation" : {
|
625
|
-
|
626
|
-
"following the '~' operator" : {
|
627
|
-
"haml" : "~ \"Foo\\n<pre>Bar\\nBaz</pre>\"",
|
628
|
-
"html" : "Foo\n<pre>Bar
Baz</pre>",
|
629
|
-
"optional" : true
|
630
|
-
},
|
631
|
-
|
632
|
-
"inside a textarea tag" : {
|
633
|
-
"haml" : "%textarea\n hello\n hello",
|
634
|
-
"html" : "<textarea>hello\nhello</textarea>"
|
635
|
-
},
|
636
|
-
|
637
|
-
"inside a pre tag" : {
|
638
|
-
"haml" : "%pre\n hello\n hello",
|
639
|
-
"html" : "<pre>hello\nhello</pre>"
|
640
|
-
}
|
641
|
-
},
|
642
|
-
|
643
|
-
"whitespace removal" : {
|
644
|
-
|
645
|
-
"a tag with '>' appended and inline content" : {
|
646
|
-
"haml" : "%li hello\n%li> world\n%li again",
|
647
|
-
"html" : "<li>hello</li><li>world</li><li>again</li>"
|
648
|
-
},
|
649
|
-
|
650
|
-
"a tag with '>' appended and nested content" : {
|
651
|
-
"haml" : "%li hello\n%li>\n world\n%li again",
|
652
|
-
"html" : "<li>hello</li><li>\n world\n</li><li>again</li>"
|
653
|
-
},
|
654
|
-
|
655
|
-
"a tag with '<' appended" : {
|
656
|
-
"haml" : "%p<\n hello\n world",
|
657
|
-
"html" : "<p>hello\nworld</p>"
|
658
|
-
}
|
659
|
-
}
|
660
|
-
}
|