UNPKG

13.5 kBJSONView Raw
1{
2 "simple test" : {
3
4 "a blank file" : {
5 "haml_template" : "text/blank",
6 "html_template" : "text/blank"
7 },
8
9 "meta tag" : {
10 "haml" : "%meta(http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\")",
11 "html" : "<meta http-equiv='content-type' content='text/html; charset=UTF-8' />"
12 }
13
14 },
15
16 "elements" : {
17
18 "a blank file" : {
19 "haml_template" : "text/div_nesting",
20 "html_template" : "text/div_nesting"
21 }
22
23 },
24
25 "data attributes" : {
26
27 "Ruby 1.8 style" : {
28 "haml" : "%a{ :href => '/link', :data => { :test => '123', :another => 'test' } }",
29 "html" : "<a href='/link' data-test='123' data-another='test'></a>"
30 },
31
32 "Ruby 1.8 style over multiple lines" : {
33 "haml" : "%a{ :href => '/link', :data => {\n :test => '123',\n :another => 'test' } }",
34 "html" : "<a href='/link' data-test='123' data-another='test'></a>"
35 },
36
37 "Ruby 1.9 style" : {
38 "haml" : "%a{ href: '/link', data: { test: '123', another: 'test' } }",
39 "html" : "<a href='/link' data-test='123' data-another='test'></a>"
40 },
41
42 "Ruby 1.9 style over multiple lines" : {
43 "haml" : "%a{ href: '/link', data: {\n test: '123',\n another: 'test' } }",
44 "html" : "<a href='/link' data-test='123' data-another='test'></a>"
45 },
46
47 "Complex data attributes" : {
48 "haml_template" : "coffee/data_attributes",
49 "html_template" : "coffee/data_attributes"
50 }
51 },
52
53 "tags with Ruby 1.9 style attributes": {
54
55 "Ruby 1.9 style one attribute" : {
56 "haml" : "%p{a: 'b'}",
57 "html" : "<p a='b'></p>",
58 "optional" : true
59 },
60
61 "Ruby 1.9 style attributes hash with whitespace" : {
62 "haml" : "%p{ a: 'b' }",
63 "html" : "<p a='b'></p>",
64 "optional" : true
65 },
66
67 "Ruby 1.9 style interpolated attribute" : {
68 "haml" : "%p{a: \"#{@var}\"}",
69 "html" : "<p a='value'></p>",
70 "optional" : true,
71 "locals" : {
72 "var" : "value"
73 }
74 },
75
76 "Ruby 1.9 style multiple attributes" : {
77 "haml" : "%p{ a: 'b', 'c': 'd' }",
78 "html" : "<p a='b' c='d'></p>",
79 "optional" : true
80 },
81
82 "Ruby 1.9 style attributes separated with newlines" : {
83 "haml" : "%p{ a: 'b',\n 'c': 'd' }",
84 "html" : "<p a='b' c='d'></p>",
85 "optional" : true
86 },
87
88 "Ruby 1.9 style 'class' as an attribute" : {
89 "haml" : "%p{class: 'class1'}",
90 "html" : "<p class='class1'></p>",
91 "optional" : true
92 },
93
94 "Ruby 1.9 style tag with a CSS class and 'class' as an attribute" : {
95 "haml" : "%p.class2{class: 'class1'}",
96 "html" : "<p class='class1 class2'></p>",
97 "optional" : true
98 },
99
100 "Ruby 1.9 style tag with 'id' as an attribute" : {
101 "haml" : "%p{id: '1'}",
102 "html" : "<p id='1'></p>",
103 "optional" : true
104 },
105
106 "Ruby 1.9 style tag with a CSS id and 'id' as an attribute" : {
107 "haml" : "%p#id{id: '1'}",
108 "html" : "<p id='id_1'></p>",
109 "optional" : true
110 },
111
112 "Ruby 1.9 style tag with a CSS id and a numeric 'id' as an attribute" : {
113 "haml" : "%p#id{id: 1}",
114 "html" : "<p id='id_1'></p>",
115 "optional" : true
116 },
117
118 "Ruby 1.9 style tag with a variable attribute" : {
119 "haml" : "%p{class: @var}",
120 "html" : "<p class='hello'></p>",
121 "optional" : true,
122 "locals" : {
123 "var" : "hello"
124 }
125 },
126
127 "Ruby 1.9 style tag with a CSS class and 'class' as a variable attribute" : {
128 "haml" : ".hello{class: @var}",
129 "html" : "<div class='hello world'></div>",
130 "optional" : true,
131 "locals" : {
132 "var" : "world"
133 }
134 },
135
136 "Ruby 1.9 style tag multiple CSS classes (sorted correctly)" : {
137 "haml" : ".z{class: @var}",
138 "html" : "<div class='a z'></div>",
139 "optional" : true,
140 "locals" : {
141 "var" : "a"
142 }
143 }
144 },
145
146 "attributes" : {
147
148 "HTML attributes with XHTML" : {
149 "haml_template" : "text/attributes",
150 "html_template" : "text/attributes_xhtml",
151 "locals" : {
152 "x" : "1"
153 },
154 "config" : {
155 "format" : "xhtml"
156 }
157 },
158
159 "Inline code attributes" : {
160 "haml_template" : "coffee/code_attributes",
161 "html_template" : "coffee/code_attributes",
162 "locals": {
163 "number": 42
164 }
165 },
166
167 "HTML attributes with HTML5" : {
168 "haml_template" : "text/attributes",
169 "html_template" : "text/attributes_html5",
170 "locals" : {
171 "x" : "1"
172 },
173 "config" : {
174 "format" : "html5"
175 }
176 },
177
178 "boolean attribute with XHTML" : {
179 "haml_template" : "text/boolean_attributes",
180 "html_template" : "text/boolean_attributes_xhtml",
181 "config" : {
182 "format" : "xhtml"
183 }
184 },
185
186 "HTML attributes without values" : {
187 "haml_template" : "text/no_value_attributes",
188 "html_template" : "text/no_value_attributes",
189 "config" : {
190 "format" : "html5"
191 }
192 },
193
194 "class concatenation" : {
195 "haml_template" : "coffee/class",
196 "html_template" : "coffee/class"
197 },
198
199 "boolean attribute with HTML" : {
200 "haml_template" : "text/boolean_attributes",
201 "html_template" : "text/boolean_attributes_html5",
202 "config" : {
203 "format" : "html5"
204 }
205 },
206
207 "Unescape assignment" : {
208 "haml" : "%p#important.text{ a: '1' }!= @text",
209 "html" : "<p class='text' id='important' a='1'><Hello&></p>",
210 "config" : {
211 "escape_html" : "true"
212 },
213 "locals" : {
214 "text" : "<Hello&>"
215 }
216 },
217
218 "Escape assignment" : {
219 "haml" : "%p#important.text{ a: '1' }&= @text",
220 "html" : "<p class='text' id='important' a='1'>&lt;Hello&amp;&gt;</p>",
221 "config" : {
222 "escape_html" : "false"
223 },
224 "locals" : {
225 "text" : "<Hello&>"
226 }
227 },
228
229 "Preserve whitespace assignment" : {
230 "haml" : "%p#important.text{ a: '1' }~ 'Foo\\n<pre>Bar\\nBaz</pre>'",
231 "html" : "<p class='text' id='important' a='1'>Foo\n<pre>Bar&#x000A;Baz</pre></p>"
232 },
233
234 "Quotes within attributes" : {
235 "haml_template" : "coffee/quotes",
236 "html_template" : "coffee/quotes",
237 "config" : {
238 "escape_html" : "true",
239 "escape_attributes" : "true"
240 }
241 }
242 },
243
244 "comments" : {
245
246 "HTML attributes" : {
247 "haml_template" : "text/comments",
248 "html_template" : "text/comments"
249 }
250
251 },
252
253 "Helpers" : {
254 "Haml helpers" : {
255 "haml_template" : "coffee/helpers",
256 "html_template" : "coffee/helpers",
257 "locals" : {
258 "food" : "chicken",
259 "thing" : "table",
260 "really": "Not really"
261 }
262 }
263 },
264
265 "CoffeeScript" : {
266
267 "attribute assignment" : {
268 "haml_template" : "coffee/attributes",
269 "html_template" : "coffee/attributes",
270 "locals" : {
271 "name" : "michi",
272 "two" : "We are two",
273 "three" : "We are three",
274 "products" : [
275 {
276 "id" : "12345",
277 "color" : "blue"
278 },
279 {
280 "id" : "999",
281 "color" : "red"
282 }
283 ],
284 "title": "Mr"
285 }
286 },
287
288 "clean escaped code values" : {
289 "haml_template" : "coffee/clean_values",
290 "html_template" : "coffee/clean_values",
291 "config" : {
292 "escape_html" : "true",
293 "escape_attributes" : "true"
294 },
295 "locals" : {
296 "nullValue" : null
297 }
298 },
299
300 "clean unescaped code values" : {
301 "haml_template" : "coffee/clean_values",
302 "html_template" : "coffee/clean_values",
303 "config" : {
304 "escape_html" : "false",
305 "escape_attributes" : "false"
306 },
307 "locals" : {
308 "nullValue" : null
309 }
310 },
311
312 "variable assignment" : {
313 "haml_template" : "coffee/variable_assignment",
314 "html_template" : "coffee/variable_assignment"
315 },
316
317 "for loop" : {
318 "haml_template" : "coffee/for_loop",
319 "html_template" : "coffee/for_loop",
320 "locals" : {
321 "projects" : [
322 {
323 "name" : "Project A",
324 "tasks" : [
325 { "name" : "Do X" },
326 { "name" : "Do Y" },
327 { "name" : "Do Z" }
328 ]
329 },
330 {
331 "name" : "Project B",
332 "tasks" : [
333 { "name" : "Do A" },
334 { "name" : "Do B" },
335 { "name" : "Do C" }
336 ]
337 }
338 ]
339 }
340 },
341
342 "loop nested arrays" : {
343 "haml_template" : "coffee/loop_nested_array",
344 "html_template" : "coffee/loop_nested_array"
345 },
346
347 "multiline assignment" : {
348 "haml_template" : "coffee/multiline",
349 "html_template" : "coffee/multiline"
350 },
351
352 "inline function that generates Haml" : {
353 "haml" : "- foo = (x) ->\n #bar= x*10\n- foo(10)",
354 "html" : "<div id='bar'>100</div>"
355 },
356
357 "complex example" : {
358 "haml_template" : "coffee/complex",
359 "html_template" : "coffee/complex",
360 "locals" : {
361 "items" : ["a", "b", "c"],
362 "project_title": "Hello World"
363 }
364 },
365
366 "Whitespace preservation" : {
367 "haml_template" : "coffee/preserve",
368 "html_template" : "coffee/preserve",
369 "locals" : {
370 "title" : "This is a\nmulti line example"
371 }
372 },
373
374 "evaluation in inserting functions" : {
375 "haml_template" : "coffee/evaluation_in_function",
376 "html_template" : "coffee/evaluation_in_function"
377 },
378
379 "extending the scope" : {
380 "haml_template" : "coffee/extend_scope",
381 "html_template" : "coffee/extend_scope",
382 "config" : {
383 "extend_scope" : "true"
384 },
385 "locals" : {
386 "name" : "Tester"
387 }
388 },
389
390 "object reference" : {
391 "haml_template" : "coffee/object_reference",
392 "html_template" : "coffee/object_reference"
393 }
394
395 },
396
397 "filters" : {
398
399 "Preserve" : {
400 "haml_template" : "filters/preserve",
401 "html_template" : "filters/preserve"
402 },
403
404 "CData" : {
405 "haml_template" : "filters/cdata",
406 "html_template" : "filters/cdata"
407 },
408
409 "Escaped" : {
410 "haml_template" : "filters/escaped",
411 "html_template" : "filters/escaped"
412 },
413
414 "Plain" : {
415 "haml_template" : "filters/plain",
416 "html_template" : "filters/plain"
417 },
418
419 "CSS for XHTML" : {
420 "haml_template" : "filters/css",
421 "html_template" : "filters/css_xhtml",
422 "config" : {
423 "format" : "xhtml"
424 }
425 },
426
427 "CSS for HTML4" : {
428 "haml_template" : "filters/css",
429 "html_template" : "filters/css_html4",
430 "config" : {
431 "format" : "html4"
432 }
433 },
434
435 "CSS for HTML5" : {
436 "haml_template" : "filters/css",
437 "html_template" : "filters/css_html5",
438 "config" : {
439 "format" : "html5"
440 }
441 },
442
443 "JavaScript for XHTML" : {
444 "haml_template" : "filters/javascript",
445 "html_template" : "filters/javascript_xhtml",
446 "config" : {
447 "format" : "xhtml"
448 }
449 },
450
451 "JavaScript for HTML4" : {
452 "haml_template" : "filters/javascript",
453 "html_template" : "filters/javascript_html4",
454 "config" : {
455 "format" : "html4"
456 }
457 },
458
459 "JavaScript for HTML5" : {
460 "haml_template" : "filters/javascript",
461 "html_template" : "filters/javascript_html5",
462 "config" : {
463 "format" : "html5"
464 }
465 },
466
467 "CoffeeScript" : {
468 "haml_template" : "filters/coffeescript",
469 "html_template" : "filters/coffeescript",
470 "locals" : {
471 "visible" : true,
472 "project" : "Haml CoffeeScript",
473 "tags" : ["Haml", "CoffeeScript"]
474 }
475 },
476
477 "JavaScript and CSS" : {
478 "haml_template" : "filters/script_css",
479 "html_template" : "filters/script_css"
480 }
481 },
482
483 "escaping" : {
484 "plain text escaping" : {
485 "haml" : "%title\n = @title\n \\= @title",
486 "html" : "<title>\n MyPage\n = @title\n</title>",
487 "locals" : {
488 "title" : "MyPage"
489 }
490 },
491
492 "escaping off" : {
493 "haml_template" : "text/escaping",
494 "html_template" : "text/escaping_off",
495 "config" : {
496 "escape_html" : "false"
497 },
498 "locals" : {
499 "title" : "html <em>escaping</em> test"
500 }
501 },
502
503 "escaping on" : {
504 "haml_template" : "text/escaping",
505 "html_template" : "text/escaping_on",
506 "config" : {
507 "escape_html" : "true"
508 },
509 "locals" : {
510 "title" : "html <em>escaping</em> test"
511 }
512 }
513 },
514
515 "special texts" : {
516
517 "embedding HTML" : {
518 "haml_template" : "text/embedded_html",
519 "html_template" : "text/embedded_html"
520 },
521
522 "long plain text" : {
523 "haml_template" : "text/long",
524 "html_template" : "text/long"
525 },
526
527 "Haml online example" : {
528 "haml_template" : "text/haml_online_example",
529 "html_template" : "text/haml_online_example"
530 },
531
532 "Whitespace" : {
533 "haml_template" : "text/whitespace",
534 "html_template" : "text/whitespace"
535 },
536
537 "wrong indention" : {
538 "haml_template" : "text/indention",
539 "html_template" : "text/indention"
540 }
541
542 },
543
544 "directives" : {
545 "include" : {
546 "haml_template" : "directives/include",
547 "html_template" : "directives/include",
548 "config": {
549 "placement": "global"
550 },
551 "partials" : {
552 "partials/test" : "directives/partials/test"
553 }
554 }
555 }
556
557}