haml 4.1.0.beta.1 → 5.0.0.beta.2

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +36 -6
  4. data/FAQ.md +4 -14
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +81 -48
  7. data/REFERENCE.md +86 -50
  8. data/Rakefile +28 -41
  9. data/lib/haml/attribute_builder.rb +163 -0
  10. data/lib/haml/attribute_compiler.rb +214 -0
  11. data/lib/haml/attribute_parser.rb +112 -0
  12. data/lib/haml/buffer.rb +24 -126
  13. data/lib/haml/compiler.rb +62 -281
  14. data/lib/haml/engine.rb +16 -23
  15. data/lib/haml/error.rb +2 -0
  16. data/lib/haml/escapable.rb +48 -0
  17. data/lib/haml/exec.rb +23 -12
  18. data/lib/haml/filters.rb +3 -4
  19. data/lib/haml/generator.rb +36 -0
  20. data/lib/haml/helpers.rb +61 -48
  21. data/lib/haml/helpers/action_view_extensions.rb +1 -1
  22. data/lib/haml/helpers/action_view_mods.rb +32 -50
  23. data/lib/haml/helpers/safe_erubi_template.rb +26 -0
  24. data/lib/haml/helpers/safe_erubis_template.rb +2 -0
  25. data/lib/haml/helpers/xss_mods.rb +17 -12
  26. data/lib/haml/options.rb +32 -36
  27. data/lib/haml/parser.rb +61 -38
  28. data/lib/haml/{template/plugin.rb → plugin.rb} +5 -2
  29. data/lib/haml/railtie.rb +14 -6
  30. data/lib/haml/template.rb +11 -6
  31. data/lib/haml/temple_engine.rb +119 -0
  32. data/lib/haml/temple_line_counter.rb +28 -0
  33. data/lib/haml/util.rb +17 -112
  34. data/lib/haml/version.rb +1 -1
  35. data/test/attribute_parser_test.rb +105 -0
  36. data/test/engine_test.rb +202 -106
  37. data/test/filters_test.rb +32 -19
  38. data/test/gemfiles/Gemfile.rails-4.0.x +7 -1
  39. data/test/gemfiles/Gemfile.rails-4.0.x.lock +57 -71
  40. data/test/gemfiles/Gemfile.rails-4.1.x +5 -0
  41. data/test/gemfiles/Gemfile.rails-4.2.x +5 -0
  42. data/test/gemfiles/Gemfile.rails-5.0.x +4 -0
  43. data/test/helper_test.rb +156 -109
  44. data/test/options_test.rb +21 -0
  45. data/test/parser_test.rb +49 -4
  46. data/test/results/eval_suppressed.xhtml +4 -4
  47. data/test/results/helpers.xhtml +43 -41
  48. data/test/results/helpful.xhtml +6 -3
  49. data/test/results/just_stuff.xhtml +21 -20
  50. data/test/results/list.xhtml +9 -9
  51. data/test/results/nuke_inner_whitespace.xhtml +22 -22
  52. data/test/results/nuke_outer_whitespace.xhtml +84 -92
  53. data/test/results/original_engine.xhtml +17 -17
  54. data/test/results/partial_layout.xhtml +4 -3
  55. data/test/results/partial_layout_erb.xhtml +4 -3
  56. data/test/results/partials.xhtml +11 -10
  57. data/test/results/silent_script.xhtml +63 -63
  58. data/test/results/standard.xhtml +156 -159
  59. data/test/results/tag_parsing.xhtml +19 -19
  60. data/test/results/very_basic.xhtml +2 -2
  61. data/test/results/whitespace_handling.xhtml +77 -76
  62. data/test/template_test.rb +21 -48
  63. data/test/template_test_helper.rb +38 -0
  64. data/test/templates/just_stuff.haml +1 -0
  65. data/test/templates/standard_ugly.haml +1 -0
  66. data/test/temple_line_counter_test.rb +40 -0
  67. data/test/test_helper.rb +10 -10
  68. data/test/util_test.rb +1 -48
  69. metadata +49 -35
  70. data/lib/haml/temple.rb +0 -85
  71. data/test/gemfiles/Gemfile.rails-3.2.x +0 -4
  72. data/test/templates/_av_partial_1_ugly.haml +0 -9
  73. data/test/templates/_av_partial_2_ugly.haml +0 -5
  74. data/test/templates/action_view_ugly.haml +0 -47
  75. data/test/templates/standard_ugly.haml +0 -43
@@ -1,20 +1,20 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
2
  <html>
3
- <head>
4
- <title>Stop. haml time</title>
5
- <div id='content'>
6
- <h1>This is a title!</h1>
7
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
8
- <p class='foo'>Cigarettes!</p>
9
- <h2>Man alive!</h2>
10
- <ul class='things'>
11
- <li>Slippers</li>
12
- <li>Shoes</li>
13
- <li>Bathrobe</li>
14
- <li>Coffee</li>
15
- </ul>
16
- <pre>This is some text that's in a pre block!
17
- Let's see what happens when it's rendered! What about now, since we're on a new line?</pre>
18
- </div>
19
- </head>
3
+ <head>
4
+ <title>Stop. haml time</title>
5
+ <div id='content'>
6
+ <h1>This is a title!</h1>
7
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
8
+ <p class='foo'>Cigarettes!</p>
9
+ <h2>Man alive!</h2>
10
+ <ul class='things'>
11
+ <li>Slippers</li>
12
+ <li>Shoes</li>
13
+ <li>Bathrobe</li>
14
+ <li>Coffee</li>
15
+ </ul>
16
+ <pre>This is some text that's in a pre block!
17
+ Let's see what happens when it's rendered! What about now, since we're on a new line?</pre>
18
+ </div>
19
+ </head>
20
20
  </html>
@@ -1,5 +1,6 @@
1
1
  <h1>Partial layout used with for block:</h1>
2
2
  <div class='partial-layout'>
3
- <h2>This is inside a partial layout</h2>
4
- <p>Some content within a layout</p>
5
- </div>
3
+ <h2>This is inside a partial layout</h2>
4
+ <p>Some content within a layout</p>
5
+
6
+ </div>
@@ -1,5 +1,6 @@
1
1
  <h1>Partial layout used with for block:</h1>
2
2
  <div class='partial-layout'>
3
- <h2>This is inside a partial layout</h2>
4
- Some content within a layout
5
- </div>
3
+ <h2>This is inside a partial layout</h2>
4
+ Some content within a layout
5
+
6
+ </div>
@@ -1,21 +1,22 @@
1
1
  <p>
2
- @foo =
3
- value one
2
+ @foo =
3
+ value one
4
4
  </p>
5
5
  <p>
6
- @foo =
7
- value two
6
+ @foo =
7
+ value two
8
8
  </p>
9
9
  <p>
10
- @foo =
11
- value two
10
+ @foo =
11
+ value two
12
12
  </p>
13
13
  Toplevel? false
14
14
  <p>
15
- @foo =
16
- value three
15
+ @foo =
16
+ value three
17
17
  </p>
18
+
18
19
  <p>
19
- @foo =
20
- value three
20
+ @foo =
21
+ value three
21
22
  </p>
@@ -1,68 +1,68 @@
1
1
  <div>
2
- <h1>I can count!</h1>
3
- 1
4
- 2
5
- 3
6
- 4
7
- 5
8
- 6
9
- 7
10
- 8
11
- 9
12
- 10
13
- 11
14
- 12
15
- 13
16
- 14
17
- 15
18
- 16
19
- 17
20
- 18
21
- 19
22
- 20
23
- <h1>I know my ABCs!</h1>
24
- <ul>
25
- <li>a</li>
26
- <li>b</li>
27
- <li>c</li>
28
- <li>d</li>
29
- <li>e</li>
30
- <li>f</li>
31
- <li>g</li>
32
- <li>h</li>
33
- <li>i</li>
34
- <li>j</li>
35
- <li>k</li>
36
- <li>l</li>
37
- <li>m</li>
38
- <li>n</li>
39
- <li>o</li>
40
- <li>p</li>
41
- <li>q</li>
42
- <li>r</li>
43
- <li>s</li>
44
- <li>t</li>
45
- <li>u</li>
46
- <li>v</li>
47
- <li>w</li>
48
- <li>x</li>
49
- <li>y</li>
50
- <li>z</li>
51
- </ul>
52
- <h1>I can catch errors!</h1>
53
- Oh no! "foo" happened!
54
- <p>
55
- "false" is:
56
- false
57
- </p>
58
- Even!
59
- Odd!
60
- Even!
61
- Odd!
62
- Even!
2
+ <h1>I can count!</h1>
3
+ 1
4
+ 2
5
+ 3
6
+ 4
7
+ 5
8
+ 6
9
+ 7
10
+ 8
11
+ 9
12
+ 10
13
+ 11
14
+ 12
15
+ 13
16
+ 14
17
+ 15
18
+ 16
19
+ 17
20
+ 18
21
+ 19
22
+ 20
23
+ <h1>I know my ABCs!</h1>
24
+ <ul>
25
+ <li>a</li>
26
+ <li>b</li>
27
+ <li>c</li>
28
+ <li>d</li>
29
+ <li>e</li>
30
+ <li>f</li>
31
+ <li>g</li>
32
+ <li>h</li>
33
+ <li>i</li>
34
+ <li>j</li>
35
+ <li>k</li>
36
+ <li>l</li>
37
+ <li>m</li>
38
+ <li>n</li>
39
+ <li>o</li>
40
+ <li>p</li>
41
+ <li>q</li>
42
+ <li>r</li>
43
+ <li>s</li>
44
+ <li>t</li>
45
+ <li>u</li>
46
+ <li>v</li>
47
+ <li>w</li>
48
+ <li>x</li>
49
+ <li>y</li>
50
+ <li>z</li>
51
+ </ul>
52
+ <h1>I can catch errors!</h1>
53
+ Oh no! "foo" happened!
54
+ <p>
55
+ "false" is:
56
+ false
57
+ </p>
58
+ Even!
59
+ Odd!
60
+ Even!
61
+ Odd!
62
+ Even!
63
63
  </div>
64
64
  <div class='foo'>
65
- <strong>foobar</strong>
65
+ <strong>foobar</strong>
66
66
  </div>
67
67
  <strong>0</strong>
68
68
  <strong>1</strong>
@@ -70,5 +70,5 @@
70
70
  <strong>3</strong>
71
71
  <strong>4</strong>
72
72
  <div class='test'>
73
- <p>boom</p>
73
+ <p>boom</p>
74
74
  </div>
@@ -1,162 +1,159 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
2
  <html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>Hampton Catlin Is Totally Awesome</title>
5
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
6
- </head>
7
- <body>
8
- <!-- You're In my house now! -->
9
- <div class='header'>
10
- Yes, ladies and gentileman. He is just that egotistical.
11
- Fantastic! This should be multi-line output
12
- The question is if this would translate! Ahah!
13
- 20
14
- </div>
15
- <div id='body'> Quotes should be loved! Just like people!</div>
16
- 0
17
- 1
18
- 2
19
- 3
20
- 4
21
- 5
22
- 6
23
- 7
24
- 8
25
- 9
26
- 10
27
- 11
28
- 12
29
- 13
30
- 14
31
- 15
32
- 16
33
- 17
34
- 18
35
- 19
36
- 20
37
- 21
38
- 22
39
- 23
40
- 24
41
- 25
42
- 26
43
- 27
44
- 28
45
- 29
46
- 30
47
- 31
48
- 32
49
- 33
50
- 34
51
- 35
52
- 36
53
- 37
54
- 38
55
- 39
56
- 40
57
- 41
58
- 42
59
- 43
60
- 44
61
- 45
62
- 46
63
- 47
64
- 48
65
- 49
66
- 50
67
- 51
68
- 52
69
- 53
70
- 54
71
- 55
72
- 56
73
- 57
74
- 58
75
- 59
76
- 60
77
- 61
78
- 62
79
- 63
80
- 64
81
- 65
82
- 66
83
- 67
84
- 68
85
- 69
86
- 70
87
- 71
88
- 72
89
- 73
90
- 74
91
- 75
92
- 76
93
- 77
94
- 78
95
- 79
96
- 80
97
- 81
98
- 82
99
- 83
100
- 84
101
- 85
102
- 86
103
- 87
104
- 88
105
- 89
106
- 90
107
- 91
108
- 92
109
- 93
110
- 94
111
- 95
112
- 96
113
- 97
114
- 98
115
- 99
116
- 100
117
- 101
118
- 102
119
- 103
120
- 104
121
- 105
122
- 106
123
- 107
124
- 108
125
- 109
126
- 110
127
- 111
128
- 112
129
- 113
130
- 114
131
- 115
132
- 116
133
- 117
134
- 118
135
- 119
136
- Wow.|
137
- <p code='3'>
138
- Holy cow multiline tags! A pipe (|) even!
139
- PipesIgnored|PipesIgnored|PipesIgnored|
140
- 1|2|3
141
- </p>
142
- <div class='silent' foo='17'>
143
- this shouldn't evaluate but now it should!
144
- </div>
145
- <ul class='really cool'>
146
- <li>a</li>
147
- <li>b</li>
148
- <li>c</li>
149
- <li>d</li>
150
- <li>e</li>
151
- <li>f</li>
152
- </ul>
153
- <div class='of_divs_with_underscore' id='combo'>with this text</div>
154
- foo
155
- <div class='footer'>
156
- <strong class='shout'>
157
- This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid.
158
- So, I'm just making it *really* long. God, I hope this works
159
- </strong>
160
- </div>
161
- </body>
3
+ <head>
4
+ <title>Hampton Catlin Is Totally Awesome</title>
5
+ <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
6
+ </head>
7
+ <body>
8
+ <!-- You're In my house now! -->
9
+ <div class='header'>
10
+ Yes, ladies and gentileman. He is just that egotistical.
11
+ Fantastic! This should be multi-line output
12
+ The question is if this would translate! Ahah!
13
+ 20
14
+ </div>
15
+ <div id='body'> Quotes should be loved! Just like people!</div>
16
+ 0
17
+ 1
18
+ 2
19
+ 3
20
+ 4
21
+ 5
22
+ 6
23
+ 7
24
+ 8
25
+ 9
26
+ 10
27
+ 11
28
+ 12
29
+ 13
30
+ 14
31
+ 15
32
+ 16
33
+ 17
34
+ 18
35
+ 19
36
+ 20
37
+ 21
38
+ 22
39
+ 23
40
+ 24
41
+ 25
42
+ 26
43
+ 27
44
+ 28
45
+ 29
46
+ 30
47
+ 31
48
+ 32
49
+ 33
50
+ 34
51
+ 35
52
+ 36
53
+ 37
54
+ 38
55
+ 39
56
+ 40
57
+ 41
58
+ 42
59
+ 43
60
+ 44
61
+ 45
62
+ 46
63
+ 47
64
+ 48
65
+ 49
66
+ 50
67
+ 51
68
+ 52
69
+ 53
70
+ 54
71
+ 55
72
+ 56
73
+ 57
74
+ 58
75
+ 59
76
+ 60
77
+ 61
78
+ 62
79
+ 63
80
+ 64
81
+ 65
82
+ 66
83
+ 67
84
+ 68
85
+ 69
86
+ 70
87
+ 71
88
+ 72
89
+ 73
90
+ 74
91
+ 75
92
+ 76
93
+ 77
94
+ 78
95
+ 79
96
+ 80
97
+ 81
98
+ 82
99
+ 83
100
+ 84
101
+ 85
102
+ 86
103
+ 87
104
+ 88
105
+ 89
106
+ 90
107
+ 91
108
+ 92
109
+ 93
110
+ 94
111
+ 95
112
+ 96
113
+ 97
114
+ 98
115
+ 99
116
+ 100
117
+ 101
118
+ 102
119
+ 103
120
+ 104
121
+ 105
122
+ 106
123
+ 107
124
+ 108
125
+ 109
126
+ 110
127
+ 111
128
+ 112
129
+ 113
130
+ 114
131
+ 115
132
+ 116
133
+ 117
134
+ 118
135
+ 119
136
+ Wow.|
137
+ <p code='3'>
138
+ Holy cow multiline tags! A pipe (|) even!
139
+ PipesIgnored|PipesIgnored|PipesIgnored|
140
+ 1|2|3
141
+ </p>
142
+ <div class='silent' foo='17'>
143
+ this shouldn't evaluate but now it should!
144
+ </div>
145
+ <ul class='really cool'>
146
+ <li>a</li>
147
+ <li>b</li>
148
+ <li>c</li>
149
+ <li>d</li>
150
+ <li>e</li>
151
+ <li>f</li>
152
+ </ul>
153
+ <div class='of_divs_with_underscore' id='combo'>with this text</div>
154
+ foo<div class='footer'>
155
+ <strong class='shout'>This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid.
156
+ So, I'm just making it *really* long. God, I hope this works</strong>
157
+ </div>
158
+ </body>
162
159
  </html>