-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathhaml_coffee_spec.json
More file actions
570 lines (488 loc) · 13.5 KB
/
Copy pathhaml_coffee_spec.json
File metadata and controls
570 lines (488 loc) · 13.5 KB
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
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
413
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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
{
"simple test" : {
"a blank file" : {
"haml_template" : "text/blank",
"html_template" : "text/blank"
},
"meta tag" : {
"haml" : "%meta(http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\")",
"html" : "<meta http-equiv='content-type' content='text/html; charset=UTF-8' />"
}
},
"elements" : {
"a blank file" : {
"haml_template" : "text/div_nesting",
"html_template" : "text/div_nesting"
}
},
"data attributes" : {
"Ruby 1.8 style" : {
"haml" : "%a{ :href => '/link', :data => { :test => '123', :another => 'test' } }",
"html" : "<a href='/link' data-test='123' data-another='test'></a>"
},
"Ruby 1.8 style over multiple lines" : {
"haml" : "%a{ :href => '/link', :data => {\n :test => '123',\n :another => 'test' } }",
"html" : "<a href='/link' data-test='123' data-another='test'></a>"
},
"Ruby 1.9 style" : {
"haml" : "%a{ href: '/link', data: { test: '123', another: 'test' } }",
"html" : "<a href='/link' data-test='123' data-another='test'></a>"
},
"Ruby 1.9 style over multiple lines" : {
"haml" : "%a{ href: '/link', data: {\n test: '123',\n another: 'test' } }",
"html" : "<a href='/link' data-test='123' data-another='test'></a>"
},
"Complex data attributes" : {
"haml_template" : "coffee/data_attributes",
"html_template" : "coffee/data_attributes"
}
},
"tags with Ruby 1.9 style attributes": {
"Ruby 1.9 style one attribute" : {
"haml" : "%p{a: 'b'}",
"html" : "<p a='b'></p>",
"optional" : true
},
"Ruby 1.9 style attributes hash with whitespace" : {
"haml" : "%p{ a: 'b' }",
"html" : "<p a='b'></p>",
"optional" : true
},
"Ruby 1.9 style interpolated attribute" : {
"haml" : "%p{a: \"#{@var}\"}",
"html" : "<p a='value'></p>",
"optional" : true,
"locals" : {
"var" : "value"
}
},
"Ruby 1.9 style multiple attributes" : {
"haml" : "%p{ a: 'b', 'c': 'd' }",
"html" : "<p a='b' c='d'></p>",
"optional" : true
},
"Ruby 1.9 style attributes separated with newlines" : {
"haml" : "%p{ a: 'b',\n 'c': 'd' }",
"html" : "<p a='b' c='d'></p>",
"optional" : true
},
"Ruby 1.9 style 'class' as an attribute" : {
"haml" : "%p{class: 'class1'}",
"html" : "<p class='class1'></p>",
"optional" : true
},
"Ruby 1.9 style tag with a CSS class and 'class' as an attribute" : {
"haml" : "%p.class2{class: 'class1'}",
"html" : "<p class='class1 class2'></p>",
"optional" : true
},
"Ruby 1.9 style tag with 'id' as an attribute" : {
"haml" : "%p{id: '1'}",
"html" : "<p id='1'></p>",
"optional" : true
},
"Ruby 1.9 style tag with a CSS id and 'id' as an attribute" : {
"haml" : "%p#id{id: '1'}",
"html" : "<p id='id_1'></p>",
"optional" : true
},
"Ruby 1.9 style tag with a CSS id and a numeric 'id' as an attribute" : {
"haml" : "%p#id{id: 1}",
"html" : "<p id='id_1'></p>",
"optional" : true
},
"Ruby 1.9 style tag with a variable attribute" : {
"haml" : "%p{class: @var}",
"html" : "<p class='hello'></p>",
"optional" : true,
"locals" : {
"var" : "hello"
}
},
"Ruby 1.9 style tag with a CSS class and 'class' as a variable attribute" : {
"haml" : ".hello{class: @var}",
"html" : "<div class='hello world'></div>",
"optional" : true,
"locals" : {
"var" : "world"
}
},
"Ruby 1.9 style tag multiple CSS classes (sorted correctly)" : {
"haml" : ".z{class: @var}",
"html" : "<div class='a z'></div>",
"optional" : true,
"locals" : {
"var" : "a"
}
}
},
"attributes" : {
"HTML attributes with XHTML" : {
"haml_template" : "text/attributes",
"html_template" : "text/attributes_xhtml",
"locals" : {
"x" : "1"
},
"config" : {
"format" : "xhtml"
}
},
"Inline code attributes" : {
"haml_template" : "coffee/code_attributes",
"html_template" : "coffee/code_attributes",
"locals": {
"number": 42
}
},
"HTML attributes with HTML5" : {
"haml_template" : "text/attributes",
"html_template" : "text/attributes_html5",
"locals" : {
"x" : "1"
},
"config" : {
"format" : "html5"
}
},
"boolean attribute with XHTML" : {
"haml_template" : "text/boolean_attributes",
"html_template" : "text/boolean_attributes_xhtml",
"config" : {
"format" : "xhtml"
}
},
"HTML attributes without values" : {
"haml_template" : "text/no_value_attributes",
"html_template" : "text/no_value_attributes",
"config" : {
"format" : "html5"
}
},
"class concatenation" : {
"haml_template" : "coffee/class",
"html_template" : "coffee/class"
},
"boolean attribute with HTML" : {
"haml_template" : "text/boolean_attributes",
"html_template" : "text/boolean_attributes_html5",
"config" : {
"format" : "html5"
}
},
"Unescape assignment" : {
"haml" : "%p#important.text{ a: '1' }!= @text",
"html" : "<p class='text' id='important' a='1'><Hello&></p>",
"config" : {
"escape_html" : "true"
},
"locals" : {
"text" : "<Hello&>"
}
},
"Escape assignment" : {
"haml" : "%p#important.text{ a: '1' }&= @text",
"html" : "<p class='text' id='important' a='1'><Hello&></p>",
"config" : {
"escape_html" : "false"
},
"locals" : {
"text" : "<Hello&>"
}
},
"Preserve whitespace assignment" : {
"haml" : "%p#important.text{ a: '1' }~ 'Foo\\n<pre>Bar\\nBaz</pre>'",
"html" : "<p class='text' id='important' a='1'>Foo\n<pre>Bar
Baz</pre></p>"
},
"Quotes within attributes" : {
"haml_template" : "coffee/quotes",
"html_template" : "coffee/quotes",
"config" : {
"escape_html" : "true",
"escape_attributes" : "true"
}
}
},
"comments" : {
"HTML attributes" : {
"haml_template" : "text/comments",
"html_template" : "text/comments"
}
},
"Helpers" : {
"Haml helpers" : {
"haml_template" : "coffee/helpers",
"html_template" : "coffee/helpers",
"locals" : {
"food" : "chicken",
"thing" : "table",
"really": "Not really"
}
}
},
"CoffeeScript" : {
"attribute assignment" : {
"haml_template" : "coffee/attributes",
"html_template" : "coffee/attributes",
"locals" : {
"name" : "michi",
"two" : "We are two",
"three" : "We are three",
"products" : [
{
"id" : "12345",
"color" : "blue"
},
{
"id" : "999",
"color" : "red"
}
],
"title": "Mr"
}
},
"clean escaped code values" : {
"haml_template" : "coffee/clean_values",
"html_template" : "coffee/clean_values",
"config" : {
"escape_html" : "true",
"escape_attributes" : "true"
},
"locals" : {
"nullValue" : null
}
},
"clean unescaped code values" : {
"haml_template" : "coffee/clean_values",
"html_template" : "coffee/clean_values",
"config" : {
"escape_html" : "false",
"escape_attributes" : "false"
},
"locals" : {
"nullValue" : null
}
},
"variable assignment" : {
"haml_template" : "coffee/variable_assignment",
"html_template" : "coffee/variable_assignment"
},
"for loop" : {
"haml_template" : "coffee/for_loop",
"html_template" : "coffee/for_loop",
"locals" : {
"projects" : [
{
"name" : "Project A",
"tasks" : [
{ "name" : "Do X" },
{ "name" : "Do Y" },
{ "name" : "Do Z" }
]
},
{
"name" : "Project B",
"tasks" : [
{ "name" : "Do A" },
{ "name" : "Do B" },
{ "name" : "Do C" }
]
}
]
}
},
"loop nested arrays" : {
"haml_template" : "coffee/loop_nested_array",
"html_template" : "coffee/loop_nested_array"
},
"multiline assignment" : {
"haml_template" : "coffee/multiline",
"html_template" : "coffee/multiline"
},
"inline function that generates Haml" : {
"haml" : "- foo = (x) ->\n #bar= x*10\n- foo(10)",
"html" : "<div id='bar'>100</div>"
},
"complex example" : {
"haml_template" : "coffee/complex",
"html_template" : "coffee/complex",
"locals" : {
"items" : ["a", "b", "c"],
"project_title": "Hello World"
}
},
"Whitespace preservation" : {
"haml_template" : "coffee/preserve",
"html_template" : "coffee/preserve",
"locals" : {
"title" : "This is a\nmulti line example"
}
},
"evaluation in inserting functions" : {
"haml_template" : "coffee/evaluation_in_function",
"html_template" : "coffee/evaluation_in_function"
},
"extending the scope" : {
"haml_template" : "coffee/extend_scope",
"html_template" : "coffee/extend_scope",
"config" : {
"extend_scope" : "true"
},
"locals" : {
"name" : "Tester"
}
},
"object reference" : {
"haml_template" : "coffee/object_reference",
"html_template" : "coffee/object_reference"
}
},
"filters" : {
"Preserve" : {
"haml_template" : "filters/preserve",
"html_template" : "filters/preserve"
},
"CData" : {
"haml_template" : "filters/cdata",
"html_template" : "filters/cdata"
},
"Escaped" : {
"haml_template" : "filters/escaped",
"html_template" : "filters/escaped"
},
"Plain" : {
"haml_template" : "filters/plain",
"html_template" : "filters/plain"
},
"CSS for XHTML" : {
"haml_template" : "filters/css",
"html_template" : "filters/css_xhtml",
"config" : {
"format" : "xhtml"
}
},
"CSS for HTML4" : {
"haml_template" : "filters/css",
"html_template" : "filters/css_html4",
"config" : {
"format" : "html4"
}
},
"CSS for HTML5" : {
"haml_template" : "filters/css",
"html_template" : "filters/css_html5",
"config" : {
"format" : "html5"
}
},
"JavaScript for XHTML" : {
"haml_template" : "filters/javascript",
"html_template" : "filters/javascript_xhtml",
"config" : {
"format" : "xhtml"
}
},
"JavaScript for HTML4" : {
"haml_template" : "filters/javascript",
"html_template" : "filters/javascript_html4",
"config" : {
"format" : "html4"
}
},
"JavaScript for HTML5" : {
"haml_template" : "filters/javascript",
"html_template" : "filters/javascript_html5",
"config" : {
"format" : "html5"
}
},
"CoffeeScript" : {
"haml_template" : "filters/coffeescript",
"html_template" : "filters/coffeescript",
"locals" : {
"visible" : true,
"project" : "Haml CoffeeScript",
"tags" : ["Haml", "CoffeeScript"]
}
},
"JavaScript and CSS" : {
"haml_template" : "filters/script_css",
"html_template" : "filters/script_css"
}
},
"escaping" : {
"plain text escaping" : {
"haml" : "%title\n = @title\n \\= @title",
"html" : "<title>\n MyPage\n = @title\n</title>",
"locals" : {
"title" : "MyPage"
}
},
"escaping off" : {
"haml_template" : "text/escaping",
"html_template" : "text/escaping_off",
"config" : {
"escape_html" : "false"
},
"locals" : {
"title" : "html <em>escaping</em> test"
}
},
"escaping on" : {
"haml_template" : "text/escaping",
"html_template" : "text/escaping_on",
"config" : {
"escape_html" : "true"
},
"locals" : {
"title" : "html <em>escaping</em> test"
}
}
},
"special texts" : {
"embedding HTML" : {
"haml_template" : "text/embedded_html",
"html_template" : "text/embedded_html"
},
"long plain text" : {
"haml_template" : "text/long",
"html_template" : "text/long"
},
"Haml online example" : {
"haml_template" : "text/haml_online_example",
"html_template" : "text/haml_online_example"
},
"Whitespace" : {
"haml_template" : "text/whitespace",
"html_template" : "text/whitespace"
},
"wrong indention" : {
"haml_template" : "text/indention",
"html_template" : "text/indention"
}
},
"directives" : {
"include global" : {
"haml_template" : "directives/include",
"html_template" : "directives/include",
"config": {
"placement": "global"
},
"partials" : {
"partials/test" : "directives/partials/test"
},
"locals" : {
"title": "Title For the partial."
}
},
"include standalone" : {
"haml_template" : "directives/include",
"html_template" : "directives/include",
"config": {
"placement": "standalone"
},
"locals" : {
"title": "Title For the partial."
}
}
}
}