haml 1.8.0 → 2.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.
- data/FAQ +138 -0
- data/MIT-LICENSE +1 -1
- data/{README → README.rdoc} +66 -3
- data/Rakefile +111 -147
- data/VERSION +1 -1
- data/bin/css2sass +0 -0
- data/bin/haml +0 -0
- data/bin/html2haml +0 -0
- data/bin/sass +0 -0
- data/init.rb +6 -1
- data/lib/haml/buffer.rb +121 -63
- data/lib/haml/engine.rb +67 -44
- data/lib/haml/error.rb +16 -6
- data/lib/haml/exec.rb +37 -7
- data/lib/haml/filters.rb +213 -68
- data/lib/haml/helpers/action_view_extensions.rb +1 -1
- data/lib/haml/helpers/action_view_mods.rb +57 -9
- data/lib/haml/helpers.rb +105 -61
- data/lib/haml/html.rb +6 -6
- data/lib/haml/precompiler.rb +268 -132
- data/lib/haml/template/patch.rb +9 -2
- data/lib/haml/template/plugin.rb +61 -10
- data/lib/haml/template.rb +3 -6
- data/lib/haml.rb +464 -201
- data/lib/sass/constant/color.rb +13 -13
- data/lib/sass/constant/literal.rb +7 -7
- data/lib/sass/constant/number.rb +9 -9
- data/lib/sass/constant/operation.rb +4 -4
- data/lib/sass/constant/string.rb +3 -3
- data/lib/sass/constant.rb +22 -22
- data/lib/sass/css.rb +104 -31
- data/lib/sass/engine.rb +120 -39
- data/lib/sass/error.rb +1 -1
- data/lib/sass/plugin/merb.rb +48 -12
- data/lib/sass/plugin/rails.rb +10 -4
- data/lib/sass/plugin.rb +22 -3
- data/lib/sass/tree/attr_node.rb +5 -5
- data/lib/sass/tree/directive_node.rb +2 -7
- data/lib/sass/tree/node.rb +1 -12
- data/lib/sass/tree/rule_node.rb +39 -31
- data/lib/sass/tree/value_node.rb +1 -1
- data/lib/sass.rb +157 -12
- data/test/benchmark.rb +67 -80
- data/test/haml/engine_test.rb +318 -81
- data/test/haml/helper_test.rb +52 -16
- data/test/haml/results/content_for_layout.xhtml +1 -2
- data/test/haml/results/eval_suppressed.xhtml +2 -4
- data/test/haml/results/filters.xhtml +44 -15
- data/test/haml/results/helpers.xhtml +2 -3
- data/test/haml/results/just_stuff.xhtml +2 -6
- data/test/haml/results/nuke_inner_whitespace.xhtml +34 -0
- data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/test/haml/results/original_engine.xhtml +3 -7
- data/test/haml/results/partials.xhtml +1 -0
- data/test/haml/results/tag_parsing.xhtml +1 -6
- data/test/haml/results/very_basic.xhtml +2 -4
- data/test/haml/results/whitespace_handling.xhtml +13 -21
- data/test/haml/template_test.rb +8 -15
- data/test/haml/templates/_partial.haml +1 -0
- data/test/haml/templates/filters.haml +48 -7
- data/test/haml/templates/helpers.haml +9 -9
- data/test/haml/templates/just_stuff.haml +1 -2
- data/test/haml/templates/nuke_inner_whitespace.haml +26 -0
- data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/test/haml/templates/tag_parsing.haml +0 -3
- data/test/haml/test_helper.rb +15 -0
- data/test/sass/engine_test.rb +84 -34
- data/test/sass/plugin_test.rb +1 -1
- data/test/sass/results/import.css +2 -2
- data/test/sass/results/mixins.css +95 -0
- data/test/sass/results/multiline.css +24 -0
- data/test/sass/templates/import.sass +4 -1
- data/test/sass/templates/importee.sass +4 -0
- data/test/sass/templates/mixins.sass +76 -0
- data/test/sass/templates/multiline.sass +20 -0
- metadata +65 -53
- data/lib/haml/helpers/action_view_mods.rb.rej +0 -30
- data/lib/haml/util.rb +0 -18
- data/lib/sass/constant.rb.rej +0 -42
- data/test/haml/runner.rb +0 -16
- data/test/profile.rb +0 -65
- data/test/sass/engine_test.rb.rej +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<style>
|
|
2
2
|
p {
|
|
3
3
|
border-style: dotted;
|
|
4
|
-
border-width:
|
|
4
|
+
border-width: 22px;
|
|
5
5
|
border-color: #ff00ff; }
|
|
6
6
|
|
|
7
7
|
h1 {
|
|
@@ -11,9 +11,7 @@ TESTING HAHAHAHA!
|
|
|
11
11
|
<h1>Foo</h1>
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
<pre><code>This is preformatted
|
|
15
|
-
Look at that!
|
|
16
|
-
Wowie-zowie!</code></pre>
|
|
14
|
+
<pre><code>This is preformatted!
Look at that!
Wowie-zowie!</code></pre>
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
<p><strong>boldilicious!</strong></p>
|
|
@@ -21,31 +19,60 @@ Wowie-zowie!</code></pre>
|
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
<p><em>pretty much the same as above</em></p>
|
|
22
|
+
<p>
|
|
23
|
+
<script type='text/javascript'>
|
|
24
|
+
//<![CDATA[
|
|
25
|
+
function newline(str) {
|
|
26
|
+
return "\n" + str;
|
|
27
|
+
}
|
|
28
|
+
//]]>
|
|
29
|
+
</script>
|
|
30
|
+
</p>
|
|
24
31
|
This
|
|
25
32
|
Is
|
|
26
33
|
Plain
|
|
27
34
|
Text
|
|
28
35
|
%strong right?
|
|
36
|
+
#{not interpolated}
|
|
37
|
+
\3
|
|
38
|
+
\#{also not}
|
|
39
|
+
\\
|
|
40
|
+
<p>
|
|
41
|
+
<pre>This pre is pretty deeply
 nested.
 Does interpolation work?
|
|
42
|
+
This one is, too.
Nested, that is.
</pre>
|
|
43
|
+
</p>
|
|
44
|
+
<ul>
|
|
45
|
+
|
|
46
|
+
<li>a</li>
|
|
47
|
+
|
|
48
|
+
<li>b</li>
|
|
49
|
+
|
|
50
|
+
<li>c</li>
|
|
29
51
|
|
|
30
|
-
|
|
52
|
+
<li>d</li>
|
|
31
53
|
|
|
32
|
-
|
|
54
|
+
<li>e</li>
|
|
33
55
|
|
|
34
|
-
|
|
56
|
+
<li>f</li>
|
|
35
57
|
|
|
36
|
-
|
|
58
|
+
<li>g</li>
|
|
37
59
|
|
|
38
|
-
|
|
60
|
+
<li>h</li>
|
|
39
61
|
|
|
40
|
-
|
|
62
|
+
<li>i</li>
|
|
41
63
|
|
|
42
|
-
|
|
64
|
+
<li>j</li>
|
|
43
65
|
|
|
44
|
-
h
|
|
45
66
|
|
|
46
|
-
i
|
|
47
67
|
|
|
48
|
-
|
|
68
|
+
</ul>
|
|
69
|
+
<div class='res'>178</div>
|
|
70
|
+
<p>
|
|
71
|
+
<p>I like preserved text:</p>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<pre><code>Foo
 Bar!
Baz</code></pre>
|
|
75
|
+
</p>
|
|
49
76
|
<ul>
|
|
50
77
|
<li>Foo</li>
|
|
51
78
|
<li>Bar</li>
|
|
@@ -54,4 +81,6 @@ This
|
|
|
54
81
|
Text!
|
|
55
82
|
Hello, World!
|
|
56
83
|
How are you doing today?
|
|
57
|
-
|
|
84
|
+
<div class="foo">
|
|
85
|
+
<p>I think &mdash; or do I?</p>
|
|
86
|
+
</div>
|
|
@@ -24,9 +24,7 @@
|
|
|
24
24
|
</p>
|
|
25
25
|
</div>
|
|
26
26
|
<p>foo</p>
|
|
27
|
-
<p>
|
|
28
|
-
reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong
|
|
29
|
-
</p>
|
|
27
|
+
<p>reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong</p>
|
|
30
28
|
<div class='woah'>
|
|
31
29
|
<div id='funky'>
|
|
32
30
|
<div>
|
|
@@ -56,6 +54,7 @@ foo
|
|
|
56
54
|
@foo =
|
|
57
55
|
value one
|
|
58
56
|
</p>
|
|
57
|
+
Toplevel? false
|
|
59
58
|
<p>
|
|
60
59
|
@foo =
|
|
61
60
|
value three
|
|
@@ -27,9 +27,6 @@ stuff followed by whitespace
|
|
|
27
27
|
yee\ha
|
|
28
28
|
</p>
|
|
29
29
|
<!-- Short comment -->
|
|
30
|
-
<!--
|
|
31
|
-
This is a really long comment look how long it is it should be on a line of its own don't you think?
|
|
32
|
-
-->
|
|
33
30
|
<!--
|
|
34
31
|
This is a block comment
|
|
35
32
|
cool, huh?
|
|
@@ -62,6 +59,5 @@ testtest
|
|
|
62
59
|
<p class='article foo' id='article_1'>Blah</p>
|
|
63
60
|
<p class='article quux qux' id='article_1'>Blump</p>
|
|
64
61
|
Woah inner quotes
|
|
65
|
-
<p class='dynamic_quote' dyn='3' quotes="single '">
|
|
66
|
-
|
|
67
|
-
<p class='dynamic_atomic' dyn='3' />
|
|
62
|
+
<p class='dynamic_quote' dyn='3' quotes="single '"></p>
|
|
63
|
+
<p class='dynamic_self_closing' dyn='3' />
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
<q>Foo</q>
|
|
3
|
+
</p>
|
|
4
|
+
<p>
|
|
5
|
+
<q a='2'>Foo</q>
|
|
6
|
+
</p>
|
|
7
|
+
<p>
|
|
8
|
+
<q>Foo
|
|
9
|
+
Bar</q>
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
<q a='2'>Foo
|
|
13
|
+
Bar</q>
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
<q>Foo
|
|
17
|
+
Bar</q>
|
|
18
|
+
</p>
|
|
19
|
+
<p>
|
|
20
|
+
<q a='2'>Foo
|
|
21
|
+
Bar</q>
|
|
22
|
+
</p>
|
|
23
|
+
<p>
|
|
24
|
+
<q><div>
|
|
25
|
+
Foo
|
|
26
|
+
Bar
|
|
27
|
+
</div></q>
|
|
28
|
+
</p>
|
|
29
|
+
<p>
|
|
30
|
+
<q a='2'><div>
|
|
31
|
+
Foo
|
|
32
|
+
Bar
|
|
33
|
+
</div></q>
|
|
34
|
+
</p>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
<p><q>
|
|
3
|
+
Foo
|
|
4
|
+
</q></p>
|
|
5
|
+
</p>
|
|
6
|
+
<p>
|
|
7
|
+
<p><q a='2'>
|
|
8
|
+
Foo
|
|
9
|
+
</q></p>
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
<p><q>Foo</q></p>
|
|
13
|
+
</p>
|
|
14
|
+
<p>
|
|
15
|
+
<p><q a='2'>Foo</q></p>
|
|
16
|
+
</p>
|
|
17
|
+
<p>
|
|
18
|
+
<p><q>
|
|
19
|
+
Foo
|
|
20
|
+
</q></p>
|
|
21
|
+
</p>
|
|
22
|
+
<p>
|
|
23
|
+
<p><q a='2'>
|
|
24
|
+
Foo
|
|
25
|
+
</q></p>
|
|
26
|
+
</p>
|
|
27
|
+
<p>
|
|
28
|
+
<p><q>Foo</q></p>
|
|
29
|
+
</p>
|
|
30
|
+
<p>
|
|
31
|
+
<p><q a='2'>Foo</q></p>
|
|
32
|
+
</p>
|
|
33
|
+
<p>
|
|
34
|
+
<p><q>
|
|
35
|
+
Foo
|
|
36
|
+
Bar
|
|
37
|
+
</q></p>
|
|
38
|
+
</p>
|
|
39
|
+
<p>
|
|
40
|
+
<p><q a='2'>
|
|
41
|
+
Foo
|
|
42
|
+
Bar
|
|
43
|
+
</q></p>
|
|
44
|
+
</p>
|
|
45
|
+
<p>
|
|
46
|
+
<p><q>
|
|
47
|
+
Foo
|
|
48
|
+
Bar
|
|
49
|
+
</q></p>
|
|
50
|
+
</p>
|
|
51
|
+
<p>
|
|
52
|
+
<p><q a='2'>
|
|
53
|
+
Foo
|
|
54
|
+
Bar
|
|
55
|
+
</q></p>
|
|
56
|
+
</p>
|
|
57
|
+
<p>
|
|
58
|
+
<p>
|
|
59
|
+
foo<q>
|
|
60
|
+
Foo
|
|
61
|
+
</q>bar
|
|
62
|
+
</p>
|
|
63
|
+
</p>
|
|
64
|
+
<p>
|
|
65
|
+
<p>
|
|
66
|
+
foo<q a='2'>
|
|
67
|
+
Foo
|
|
68
|
+
</q>bar
|
|
69
|
+
</p>
|
|
70
|
+
</p>
|
|
71
|
+
<p>
|
|
72
|
+
<p>
|
|
73
|
+
foo<q>Foo</q>bar
|
|
74
|
+
</p>
|
|
75
|
+
</p>
|
|
76
|
+
<p>
|
|
77
|
+
<p>
|
|
78
|
+
foo<q a='2'>Foo</q>bar
|
|
79
|
+
</p>
|
|
80
|
+
</p>
|
|
81
|
+
<p>
|
|
82
|
+
<p>
|
|
83
|
+
foo<q>
|
|
84
|
+
Foo
|
|
85
|
+
</q>bar
|
|
86
|
+
</p>
|
|
87
|
+
</p>
|
|
88
|
+
<p>
|
|
89
|
+
<p>
|
|
90
|
+
foo<q a='2'>
|
|
91
|
+
Foo
|
|
92
|
+
</q>bar
|
|
93
|
+
</p>
|
|
94
|
+
</p>
|
|
95
|
+
<p>
|
|
96
|
+
<p>
|
|
97
|
+
foo<q>Foo</q>bar
|
|
98
|
+
</p>
|
|
99
|
+
</p>
|
|
100
|
+
<p>
|
|
101
|
+
<p>
|
|
102
|
+
foo<q a='2'>Foo</q>bar
|
|
103
|
+
</p>
|
|
104
|
+
</p>
|
|
105
|
+
<p>
|
|
106
|
+
<p>
|
|
107
|
+
foo<q>
|
|
108
|
+
Foo
|
|
109
|
+
Bar
|
|
110
|
+
</q>bar
|
|
111
|
+
</p>
|
|
112
|
+
</p>
|
|
113
|
+
<p>
|
|
114
|
+
<p>
|
|
115
|
+
foo<q a='2'>
|
|
116
|
+
Foo
|
|
117
|
+
Bar
|
|
118
|
+
</q>bar
|
|
119
|
+
</p>
|
|
120
|
+
</p>
|
|
121
|
+
<p>
|
|
122
|
+
<p>
|
|
123
|
+
foo<q>
|
|
124
|
+
Foo
|
|
125
|
+
Bar
|
|
126
|
+
</q>bar
|
|
127
|
+
</p>
|
|
128
|
+
</p>
|
|
129
|
+
<p>
|
|
130
|
+
<p>
|
|
131
|
+
foo<q a='2'>
|
|
132
|
+
Foo
|
|
133
|
+
Bar
|
|
134
|
+
</q>bar
|
|
135
|
+
</p>
|
|
136
|
+
</p>
|
|
137
|
+
<p>
|
|
138
|
+
<p><q></q></p>
|
|
139
|
+
</p>
|
|
140
|
+
<p>
|
|
141
|
+
<p><q /></p>
|
|
142
|
+
</p>
|
|
143
|
+
<p>
|
|
144
|
+
<p><q a='2'></q></p>
|
|
145
|
+
</p>
|
|
146
|
+
<p>
|
|
147
|
+
<p><q a='2' /></p>
|
|
148
|
+
</p>
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
<title>Stop. haml time</title>
|
|
5
5
|
<div id='content'>
|
|
6
6
|
<h1>This is a title!</h1>
|
|
7
|
-
<p>
|
|
8
|
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit
|
|
9
|
-
</p>
|
|
7
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
|
|
10
8
|
<p class='foo'>Cigarettes!</p>
|
|
11
9
|
<h2>Man alive!</h2>
|
|
12
10
|
<ul class='things'>
|
|
@@ -15,10 +13,8 @@
|
|
|
15
13
|
<li>Bathrobe</li>
|
|
16
14
|
<li>Coffee</li>
|
|
17
15
|
</ul>
|
|
18
|
-
<pre>
|
|
19
|
-
|
|
20
|
-
Let's see what happens when it's rendered! What about now, since we're on a new line?
|
|
21
|
-
</pre>
|
|
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>
|
|
22
18
|
</div>
|
|
23
19
|
</head>
|
|
24
20
|
</html>
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
<foo2u>11</foo2u>
|
|
13
13
|
</div>
|
|
14
14
|
<div class='classes'>
|
|
15
|
-
<p class='foo bar' id='boom'>
|
|
16
|
-
</p>
|
|
15
|
+
<p class='foo bar' id='boom'></p>
|
|
17
16
|
<div class='fooBar'>a</div>
|
|
18
17
|
<div class='foo-bar'>b</div>
|
|
19
18
|
<div class='foo_bar'>c</div>
|
|
@@ -22,7 +21,3 @@
|
|
|
22
21
|
<div class='123'>f</div>
|
|
23
22
|
<div class='foo2u'>g</div>
|
|
24
23
|
</div>
|
|
25
|
-
<div class='broken'>
|
|
26
|
-
<foo><{ :a => :b }</foo>
|
|
27
|
-
<div class='foo'>>{ :c => :d }</div>
|
|
28
|
-
</div>
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
<div class='text_area_test_area'>
|
|
13
13
|
<textarea>Oneline</textarea>
|
|
14
14
|
</div>
|
|
15
|
-
<textarea>BLAH
|
|
15
|
+
<textarea>BLAH</textarea>
|
|
16
16
|
<div class='text_area_test_area'>
|
|
17
17
|
<textarea>Two
lines</textarea>
|
|
18
18
|
</div>
|
|
19
|
-
<textarea>BLAH
|
|
19
|
+
<textarea>BLAH</textarea>
|
|
20
20
|
<div id='flattened'>
|
|
21
21
|
<div class='text_area_test_area'>
|
|
22
22
|
<textarea>Two
lines</textarea>
|
|
23
23
|
</div>
|
|
24
|
-
<textarea>BLAH
|
|
24
|
+
<textarea>BLAH</textarea>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
<div class='hithere'>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
<div class='foo'>
|
|
38
38
|
13
|
|
39
|
-
<textarea>
a
|
|
39
|
+
<textarea>
a</textarea><textarea>
b</textarea><textarea>
c</textarea>
|
|
40
40
|
</div>
|
|
41
41
|
<div id='whitespace_test'>
|
|
42
42
|
<div class='text_area_test_area'>
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
<div class='text_area_test_area'>
|
|
53
53
|
<textarea>Oneline</textarea>
|
|
54
54
|
</div>
|
|
55
|
-
<textarea>BLAH
|
|
55
|
+
<textarea>BLAH</textarea>
|
|
56
56
|
<div class='text_area_test_area'>
|
|
57
57
|
<textarea>Two
lines</textarea>
|
|
58
58
|
</div>
|
|
59
|
-
<textarea>BLAH
|
|
59
|
+
<textarea>BLAH</textarea>
|
|
60
60
|
<div id='flattened'>
|
|
61
61
|
<div class='text_area_test_area'>
|
|
62
62
|
<textarea>Two
lines</textarea>
|
|
63
63
|
</div>
|
|
64
|
-
<textarea>BLAH
|
|
64
|
+
<textarea>BLAH</textarea>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
67
|
<div class='hithere'>
|
|
@@ -73,22 +73,14 @@
|
|
|
73
73
|
foo
|
|
74
74
|
bar
|
|
75
75
|
</p>
|
|
76
|
-
<pre>
|
|
77
|
-
___
 ,o88888
 ,o8888888'
 ,:o:o:oooo. ,8O88Pd8888"
 ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
 ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
 , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
 , ..:.::o:ooOoOO8O888O8O,COCOO"
 , . ..:.::o:ooOoOOOO8OOOOCOCO"
 . ..:.::o:ooOoOoOO8O8OCCCC"o
 . ..:.::o:ooooOoCoCCC"o:o
 . ..:.::o:o:,cooooCo"oo:o:
 ` . . ..:.:cocoooo"'o:o:::'
 .` . ..::ccccoc"'o:o:o:::'
 :.:. ,c:cccc"':.:.:.:.:.'
 ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
 ...:.'.:.::::"' . . . . .'
 .. . ....:."' ` . . . ''
 . . . ...."'
 .. . ."' -hrr-
 .


 It's a planet!
%strong This shouldn't be bold!

|
|
78
|
-
</pre>
|
|
76
|
+
<pre> ___
 ,o88888
 ,o8888888'
 ,:o:o:oooo. ,8O88Pd8888"
 ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
 ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
 , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
 , ..:.::o:ooOoOO8O888O8O,COCOO"
 , . ..:.::o:ooOoOOOO8OOOOCOCO"
 . ..:.::o:ooOoOoOO8O8OCCCC"o
 . ..:.::o:ooooOoCoCCC"o:o
 . ..:.::o:o:,cooooCo"oo:o:
 ` . . ..:.:cocoooo"'o:o:::'
 .` . ..::ccccoc"'o:o:o:::'
 :.:. ,c:cccc"':.:.:.:.:.'
 ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
 ...:.'.:.::::"' . . . . .'
 .. . ....:."' ` . . . ''
 . . . ...."'
 .. . ."' -hrr-
 .


 It's a planet!
%strong This shouldn't be bold!</pre>
|
|
79
77
|
<strong>This should!</strong>
|
|
80
|
-
<textarea>
|
|
81
|
-
|
|
82
|
-
<strong>indeed!</strong>
|
|
83
|
-
</textarea>
|
|
78
|
+
<textarea> ___ ___ ___ ___ 
 /\__\ /\ \ /\__\ /\__\
 /:/ / /::\ \ /::| | /:/ /
 /:/__/ /:/\:\ \ /:|:| | /:/ / 
 /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / 
 /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ 
 \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ 
 \::/ / \::/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\ \ 
 /:/ / /:/ / /:/ / \:\__\
 \/__/ \/__/ \/__/ \/__/

 Many
 thanks
 to
 http://www.network-science.de/ascii/
|
|
79
|
+
<strong>indeed!</strong></textarea>
|
|
84
80
|
</div>
|
|
85
81
|
<div class='foo'>
|
|
86
82
|
13
|
|
87
83
|
</div>
|
|
88
|
-
<pre>
|
|
89
|
-
|
|
90
|
-
</pre>
|
|
91
|
-
<pre>
|
|
92
|
-
foo

|
|
93
|
-
bar
|
|
94
|
-
</pre>
|
|
84
|
+
<pre> __ ______ __ ______
.----.| |--.|__ |.----.| |--..--------.| __ |
| __|| ||__ || __|| < | || __ |
|____||__|__||______||____||__|__||__|__|__||______|</pre>
|
|
85
|
+
<pre>foo
|
|
86
|
+
bar</pre>
|
data/test/haml/template_test.rb
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'test/unit'
|
|
4
|
-
require 'rubygems'
|
|
5
|
-
require 'action_pack'
|
|
6
|
-
|
|
7
|
-
require File.dirname(__FILE__) + '/../../lib/haml'
|
|
2
|
+
require File.dirname(__FILE__) + '/test_helper'
|
|
8
3
|
require 'haml/template'
|
|
9
4
|
require File.dirname(__FILE__) + '/mocks/article'
|
|
10
5
|
|
|
11
|
-
class TestFilter
|
|
12
|
-
def initialize(text)
|
|
13
|
-
@text = text
|
|
14
|
-
end
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
module Haml::Filters::Test
|
|
8
|
+
include Haml::Filters::Base
|
|
9
|
+
|
|
10
|
+
def render(text)
|
|
17
11
|
"TESTING HAHAHAHA!"
|
|
18
12
|
end
|
|
19
13
|
end
|
|
@@ -22,10 +16,9 @@ class TemplateTest < Test::Unit::TestCase
|
|
|
22
16
|
@@templates = %w{ very_basic standard helpers
|
|
23
17
|
whitespace_handling original_engine list helpful
|
|
24
18
|
silent_script tag_parsing just_stuff partials
|
|
25
|
-
filters }
|
|
19
|
+
filters nuke_outer_whitespace nuke_inner_whitespace }
|
|
26
20
|
|
|
27
21
|
def setup
|
|
28
|
-
Haml::Template.options = { :filters => { 'test'=>TestFilter } }
|
|
29
22
|
@base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'})
|
|
30
23
|
@base.send(:evaluate_assigns)
|
|
31
24
|
|
|
@@ -76,7 +69,7 @@ class TemplateTest < Test::Unit::TestCase
|
|
|
76
69
|
def test_templates_should_render_correctly_with_render_proc
|
|
77
70
|
@@templates.each do |template|
|
|
78
71
|
assert_renders_correctly(template) do |name|
|
|
79
|
-
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml")
|
|
72
|
+
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
|
|
80
73
|
engine.render_proc(@base).call
|
|
81
74
|
end
|
|
82
75
|
end
|
|
@@ -87,7 +80,7 @@ class TemplateTest < Test::Unit::TestCase
|
|
|
87
80
|
assert_renders_correctly(template) do |name|
|
|
88
81
|
method = "render_haml_" + name.gsub(/[^a-zA-Z0-9]/, '_')
|
|
89
82
|
|
|
90
|
-
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml")
|
|
83
|
+
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
|
|
91
84
|
engine.def_method(@base, method)
|
|
92
85
|
@base.send(method)
|
|
93
86
|
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
%style
|
|
2
|
+
- width = 5 + 17
|
|
2
3
|
:sass
|
|
3
4
|
p
|
|
4
5
|
:border
|
|
5
6
|
:style dotted
|
|
6
|
-
:width
|
|
7
|
+
:width #{width}px
|
|
7
8
|
:color #ff00ff
|
|
8
9
|
h1
|
|
9
10
|
:font-weight normal
|
|
@@ -29,17 +30,51 @@
|
|
|
29
30
|
|
|
30
31
|
_pretty much the same as above_
|
|
31
32
|
|
|
33
|
+
%p
|
|
34
|
+
:javascript
|
|
35
|
+
function newline(str) {
|
|
36
|
+
return "\n" + str;
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
:plain
|
|
33
40
|
This
|
|
34
41
|
Is
|
|
35
42
|
Plain
|
|
36
43
|
Text
|
|
37
44
|
%strong right?
|
|
45
|
+
\#{not interpolated}
|
|
46
|
+
\\#{1 + 2}
|
|
47
|
+
\\\#{also not}
|
|
48
|
+
\\
|
|
49
|
+
|
|
50
|
+
- last = "noitalo"
|
|
51
|
+
%p
|
|
52
|
+
%pre
|
|
53
|
+
:preserve
|
|
54
|
+
This pre is pretty deeply
|
|
55
|
+
nested.
|
|
56
|
+
Does #{"interp" + last.reverse} work?
|
|
57
|
+
:preserve
|
|
58
|
+
This one is, too.
|
|
59
|
+
Nested, that is.
|
|
60
|
+
|
|
61
|
+
- num = 10
|
|
62
|
+
%ul
|
|
63
|
+
:erb
|
|
64
|
+
<% num.times do |c| %>
|
|
65
|
+
<li><%= (c+97).chr %></li>
|
|
66
|
+
<% end %>
|
|
67
|
+
<% res = 178 %>
|
|
38
68
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
.res= res
|
|
70
|
+
|
|
71
|
+
%p
|
|
72
|
+
:textile
|
|
73
|
+
I like preserved text:
|
|
74
|
+
|
|
75
|
+
Foo
|
|
76
|
+
#{"Bar"}!
|
|
77
|
+
Baz
|
|
43
78
|
|
|
44
79
|
:markdown
|
|
45
80
|
* Foo
|
|
@@ -48,6 +83,12 @@
|
|
|
48
83
|
|
|
49
84
|
= "Text!"
|
|
50
85
|
|
|
86
|
+
- var = "Hello"
|
|
51
87
|
:ruby
|
|
52
|
-
|
|
53
|
-
|
|
88
|
+
printf "%s, World!\n", var
|
|
89
|
+
print "How are you doing today?\n"
|
|
90
|
+
|
|
91
|
+
:escaped
|
|
92
|
+
<div class="foo">
|
|
93
|
+
<p>I think — or do I?</p>
|
|
94
|
+
</div>
|
|
@@ -31,10 +31,10 @@ click
|
|
|
31
31
|
= succeed '.' do
|
|
32
32
|
%a{:href=>"thing"} here
|
|
33
33
|
%p baz
|
|
34
|
-
-
|
|
34
|
+
- haml_buffer.tabulation = 10
|
|
35
35
|
%p boom
|
|
36
36
|
- concat "foo\n"
|
|
37
|
-
-
|
|
37
|
+
- haml_buffer.tabulation = 0
|
|
38
38
|
- def url_for(*stuff); stuff.join(' '); end
|
|
39
39
|
-# The form URLs must be empty
|
|
40
40
|
-# because of a weird bug that causes url_for to misbehave.
|
|
@@ -58,12 +58,12 @@ click
|
|
|
58
58
|
- puts "boom"
|
|
59
59
|
baz
|
|
60
60
|
- puts "boom, again"
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
61
|
+
- haml_tag :table do
|
|
62
|
+
- haml_tag :tr do
|
|
63
|
+
- haml_tag :td, {:class => 'cell'} do
|
|
64
|
+
- haml_tag :strong, "strong!"
|
|
65
65
|
- puts "data"
|
|
66
|
-
-
|
|
66
|
+
- haml_tag :td do
|
|
67
67
|
- puts "more_data"
|
|
68
|
-
-
|
|
69
|
-
-
|
|
68
|
+
- haml_tag :hr
|
|
69
|
+
- haml_tag :div, ''
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
\%p foo
|
|
32
32
|
\yee\ha
|
|
33
33
|
/ Short comment
|
|
34
|
-
/ This is a really long comment look how long it is it should be on a line of its own don't you think?
|
|
35
34
|
/
|
|
36
35
|
This is a block comment
|
|
37
36
|
cool, huh?
|
|
@@ -75,4 +74,4 @@
|
|
|
75
74
|
%p.qux{:class => 'quux'}[@article] Blump
|
|
76
75
|
== #{"Woah inner quotes"}
|
|
77
76
|
%p.dynamic_quote{:quotes => "single '", :dyn => 1 + 2}
|
|
78
|
-
%p.
|
|
77
|
+
%p.dynamic_self_closing{:dyn => 1 + 2}/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
%p
|
|
2
|
+
%q< Foo
|
|
3
|
+
%p
|
|
4
|
+
%q{:a => 1 + 1}< Foo
|
|
5
|
+
%p
|
|
6
|
+
%q<= "Foo\nBar"
|
|
7
|
+
%p
|
|
8
|
+
%q{:a => 1 + 1}<= "Foo\nBar"
|
|
9
|
+
%p
|
|
10
|
+
%q<
|
|
11
|
+
Foo
|
|
12
|
+
Bar
|
|
13
|
+
%p
|
|
14
|
+
%q{:a => 1 + 1}<
|
|
15
|
+
Foo
|
|
16
|
+
Bar
|
|
17
|
+
%p
|
|
18
|
+
%q<
|
|
19
|
+
%div
|
|
20
|
+
Foo
|
|
21
|
+
Bar
|
|
22
|
+
%p
|
|
23
|
+
%q{:a => 1 + 1}<
|
|
24
|
+
%div
|
|
25
|
+
Foo
|
|
26
|
+
Bar
|