haml-edge 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -0
- data/FAQ +138 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +332 -0
- data/REVISION +1 -0
- data/Rakefile +226 -0
- data/VERSION +1 -0
- data/bin/css2sass +7 -0
- data/bin/haml +9 -0
- data/bin/html2haml +7 -0
- data/bin/sass +8 -0
- data/extra/edge_gem_watch.rb +13 -0
- data/extra/haml-mode.el +596 -0
- data/extra/sass-mode.el +200 -0
- data/init.rb +8 -0
- data/lib/haml/buffer.rb +255 -0
- data/lib/haml/engine.rb +268 -0
- data/lib/haml/error.rb +22 -0
- data/lib/haml/exec.rb +395 -0
- data/lib/haml/filters.rb +275 -0
- data/lib/haml/helpers/action_view_extensions.rb +45 -0
- data/lib/haml/helpers/action_view_mods.rb +181 -0
- data/lib/haml/helpers.rb +488 -0
- data/lib/haml/html.rb +222 -0
- data/lib/haml/precompiler.rb +904 -0
- data/lib/haml/shared.rb +45 -0
- data/lib/haml/template/patch.rb +58 -0
- data/lib/haml/template/plugin.rb +72 -0
- data/lib/haml/template.rb +42 -0
- data/lib/haml/util.rb +88 -0
- data/lib/haml/version.rb +47 -0
- data/lib/haml.rb +1044 -0
- data/lib/sass/css.rb +388 -0
- data/lib/sass/engine.rb +495 -0
- data/lib/sass/environment.rb +46 -0
- data/lib/sass/error.rb +35 -0
- data/lib/sass/plugin/merb.rb +56 -0
- data/lib/sass/plugin/rails.rb +24 -0
- data/lib/sass/plugin.rb +204 -0
- data/lib/sass/repl.rb +51 -0
- data/lib/sass/script/bool.rb +13 -0
- data/lib/sass/script/color.rb +97 -0
- data/lib/sass/script/funcall.rb +29 -0
- data/lib/sass/script/functions.rb +134 -0
- data/lib/sass/script/lexer.rb +148 -0
- data/lib/sass/script/literal.rb +82 -0
- data/lib/sass/script/number.rb +231 -0
- data/lib/sass/script/operation.rb +30 -0
- data/lib/sass/script/parser.rb +142 -0
- data/lib/sass/script/string.rb +9 -0
- data/lib/sass/script/unary_operation.rb +21 -0
- data/lib/sass/script/variable.rb +20 -0
- data/lib/sass/script.rb +38 -0
- data/lib/sass/tree/attr_node.rb +64 -0
- data/lib/sass/tree/comment_node.rb +30 -0
- data/lib/sass/tree/debug_node.rb +22 -0
- data/lib/sass/tree/directive_node.rb +50 -0
- data/lib/sass/tree/file_node.rb +27 -0
- data/lib/sass/tree/for_node.rb +29 -0
- data/lib/sass/tree/if_node.rb +27 -0
- data/lib/sass/tree/mixin_def_node.rb +18 -0
- data/lib/sass/tree/mixin_node.rb +35 -0
- data/lib/sass/tree/node.rb +99 -0
- data/lib/sass/tree/rule_node.rb +161 -0
- data/lib/sass/tree/variable_node.rb +24 -0
- data/lib/sass/tree/while_node.rb +21 -0
- data/lib/sass.rb +1062 -0
- data/rails/init.rb +1 -0
- data/test/benchmark.rb +99 -0
- data/test/haml/engine_test.rb +795 -0
- data/test/haml/helper_test.rb +228 -0
- data/test/haml/html2haml_test.rb +108 -0
- data/test/haml/markaby/standard.mab +52 -0
- data/test/haml/mocks/article.rb +6 -0
- data/test/haml/results/content_for_layout.xhtml +15 -0
- data/test/haml/results/eval_suppressed.xhtml +9 -0
- data/test/haml/results/filters.xhtml +62 -0
- data/test/haml/results/helpers.xhtml +93 -0
- data/test/haml/results/helpful.xhtml +10 -0
- data/test/haml/results/just_stuff.xhtml +68 -0
- data/test/haml/results/list.xhtml +12 -0
- data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
- data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/test/haml/results/original_engine.xhtml +20 -0
- data/test/haml/results/partial_layout.xhtml +5 -0
- data/test/haml/results/partials.xhtml +21 -0
- data/test/haml/results/render_layout.xhtml +3 -0
- data/test/haml/results/silent_script.xhtml +74 -0
- data/test/haml/results/standard.xhtml +162 -0
- data/test/haml/results/tag_parsing.xhtml +23 -0
- data/test/haml/results/very_basic.xhtml +5 -0
- data/test/haml/results/whitespace_handling.xhtml +89 -0
- data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
- data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
- data/test/haml/rhtml/action_view.rhtml +62 -0
- data/test/haml/rhtml/standard.rhtml +54 -0
- data/test/haml/template_test.rb +204 -0
- data/test/haml/templates/_av_partial_1.haml +9 -0
- data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
- data/test/haml/templates/_av_partial_2.haml +5 -0
- data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
- data/test/haml/templates/_layout.erb +3 -0
- data/test/haml/templates/_layout_for_partial.haml +3 -0
- data/test/haml/templates/_partial.haml +8 -0
- data/test/haml/templates/_text_area.haml +3 -0
- data/test/haml/templates/action_view.haml +47 -0
- data/test/haml/templates/action_view_ugly.haml +47 -0
- data/test/haml/templates/breakage.haml +8 -0
- data/test/haml/templates/content_for_layout.haml +10 -0
- data/test/haml/templates/eval_suppressed.haml +11 -0
- data/test/haml/templates/filters.haml +66 -0
- data/test/haml/templates/helpers.haml +95 -0
- data/test/haml/templates/helpful.haml +11 -0
- data/test/haml/templates/just_stuff.haml +83 -0
- data/test/haml/templates/list.haml +12 -0
- data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
- data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/test/haml/templates/original_engine.haml +17 -0
- data/test/haml/templates/partial_layout.haml +3 -0
- data/test/haml/templates/partialize.haml +1 -0
- data/test/haml/templates/partials.haml +12 -0
- data/test/haml/templates/render_layout.haml +2 -0
- data/test/haml/templates/silent_script.haml +40 -0
- data/test/haml/templates/standard.haml +42 -0
- data/test/haml/templates/standard_ugly.haml +42 -0
- data/test/haml/templates/tag_parsing.haml +21 -0
- data/test/haml/templates/very_basic.haml +4 -0
- data/test/haml/templates/whitespace_handling.haml +87 -0
- data/test/haml/util_test.rb +87 -0
- data/test/linked_rails.rb +12 -0
- data/test/sass/css2sass_test.rb +193 -0
- data/test/sass/engine_test.rb +709 -0
- data/test/sass/functions_test.rb +109 -0
- data/test/sass/more_results/more1.css +9 -0
- data/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/test/sass/more_results/more_import.css +29 -0
- data/test/sass/more_templates/_more_partial.sass +2 -0
- data/test/sass/more_templates/more1.sass +23 -0
- data/test/sass/more_templates/more_import.sass +11 -0
- data/test/sass/plugin_test.rb +213 -0
- data/test/sass/results/alt.css +4 -0
- data/test/sass/results/basic.css +9 -0
- data/test/sass/results/compact.css +5 -0
- data/test/sass/results/complex.css +87 -0
- data/test/sass/results/compressed.css +1 -0
- data/test/sass/results/expanded.css +19 -0
- data/test/sass/results/import.css +29 -0
- data/test/sass/results/line_numbers.css +49 -0
- data/test/sass/results/mixins.css +95 -0
- data/test/sass/results/multiline.css +24 -0
- data/test/sass/results/nested.css +22 -0
- data/test/sass/results/parent_ref.css +13 -0
- data/test/sass/results/script.css +16 -0
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/test/sass/results/subdir/subdir.css +3 -0
- data/test/sass/results/units.css +11 -0
- data/test/sass/script_test.rb +250 -0
- data/test/sass/templates/_partial.sass +2 -0
- data/test/sass/templates/alt.sass +16 -0
- data/test/sass/templates/basic.sass +23 -0
- data/test/sass/templates/bork.sass +2 -0
- data/test/sass/templates/bork2.sass +2 -0
- data/test/sass/templates/compact.sass +17 -0
- data/test/sass/templates/complex.sass +309 -0
- data/test/sass/templates/compressed.sass +15 -0
- data/test/sass/templates/expanded.sass +17 -0
- data/test/sass/templates/import.sass +11 -0
- data/test/sass/templates/importee.sass +19 -0
- data/test/sass/templates/line_numbers.sass +13 -0
- data/test/sass/templates/mixins.sass +76 -0
- data/test/sass/templates/multiline.sass +20 -0
- data/test/sass/templates/nested.sass +25 -0
- data/test/sass/templates/parent_ref.sass +25 -0
- data/test/sass/templates/script.sass +101 -0
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/test/sass/templates/subdir/subdir.sass +6 -0
- data/test/sass/templates/units.sass +11 -0
- data/test/test_helper.rb +21 -0
- metadata +278 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
!!! XML
|
2
|
+
!!! XML ISO-8859-1
|
3
|
+
!!! XML UtF-8 Foo bar
|
4
|
+
!!!
|
5
|
+
!!! 1.1
|
6
|
+
!!! 1.1 Strict
|
7
|
+
!!! Strict foo bar
|
8
|
+
!!! FRAMESET
|
9
|
+
%strong{:apos => "Foo's bar!"} Boo!
|
10
|
+
== Embedded? false!
|
11
|
+
== Embedded? #{true}!
|
12
|
+
- embedded = true
|
13
|
+
== Embedded? #{embedded}!
|
14
|
+
== Embedded? #{"twice! #{true}"}!
|
15
|
+
== Embedded? #{"one"} af"t"er #{"another"}!
|
16
|
+
%p== Embedded? false!
|
17
|
+
%p== Embedded? #{true}!
|
18
|
+
- embedded = true
|
19
|
+
%p== Embedded? #{embedded}!
|
20
|
+
%p== Embedded? #{"twice! #{true}"}!
|
21
|
+
%p== Embedded? #{"one"} af"t"er #{"another"}!
|
22
|
+
= "stuff followed by whitespace"
|
23
|
+
|
24
|
+
- if true
|
25
|
+
|
26
|
+
%strong block with whitespace
|
27
|
+
%p
|
28
|
+
\Escape
|
29
|
+
\- character
|
30
|
+
\%p foo
|
31
|
+
\yee\ha
|
32
|
+
/ Short comment
|
33
|
+
/
|
34
|
+
This is a block comment
|
35
|
+
cool, huh?
|
36
|
+
%strong there can even be sub-tags!
|
37
|
+
= "Or script!"
|
38
|
+
-# Haml comment
|
39
|
+
-#
|
40
|
+
Nested Haml comment
|
41
|
+
- raise 'dead'
|
42
|
+
%p{ :class => "" } class attribute should appear!
|
43
|
+
%p{ :gorbachev => nil } this attribute shouldn't appear
|
44
|
+
/[if lte IE6] conditional comment!
|
45
|
+
/[if gte IE7]
|
46
|
+
%p Block conditional comment
|
47
|
+
%div
|
48
|
+
%h1 Cool, eh?
|
49
|
+
/[if gte IE5.2]
|
50
|
+
Woah a period.
|
51
|
+
= "test" |
|
52
|
+
"test" |
|
53
|
+
-# Hard tabs shouldn't throw errors.
|
54
|
+
|
55
|
+
- case :foo
|
56
|
+
- when :bar
|
57
|
+
%br Blah
|
58
|
+
- when :foo
|
59
|
+
%br
|
60
|
+
- case :foo
|
61
|
+
- when :bar
|
62
|
+
%meta{ :foo => 'blah'}
|
63
|
+
- when :foo
|
64
|
+
%meta{ :foo => 'bar'}
|
65
|
+
%img
|
66
|
+
%hr
|
67
|
+
%link
|
68
|
+
%script Inline content
|
69
|
+
%br
|
70
|
+
Nested content
|
71
|
+
%p.foo{:class => true ? 'bar' : 'baz'}[@article] Blah
|
72
|
+
%p.foo{:class => false ? 'bar' : ''}[@article] Blah
|
73
|
+
%p.qux{:class => 'quux'}[@article] Blump
|
74
|
+
== #{"Woah inner quotes"}
|
75
|
+
%p.dynamic_quote{:quotes => "single '", :dyn => 1 + 2}
|
76
|
+
%p.dynamic_self_closing{:dyn => 1 + 2}/
|
77
|
+
%body
|
78
|
+
:plain
|
79
|
+
hello
|
80
|
+
%div
|
81
|
+
|
82
|
+
%img
|
83
|
+
|
@@ -0,0 +1,32 @@
|
|
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
|
27
|
+
|
28
|
+
-# Regression test
|
29
|
+
%p
|
30
|
+
%q<= "foo"
|
31
|
+
%q{:a => 1 + 1}
|
32
|
+
bar
|
@@ -0,0 +1,144 @@
|
|
1
|
+
%p
|
2
|
+
%p
|
3
|
+
%q>
|
4
|
+
Foo
|
5
|
+
%p
|
6
|
+
%p
|
7
|
+
%q{:a => 1 + 1}>
|
8
|
+
Foo
|
9
|
+
%p
|
10
|
+
%p
|
11
|
+
%q> Foo
|
12
|
+
%p
|
13
|
+
%p
|
14
|
+
%q{:a => 1 + 1}> Foo
|
15
|
+
%p
|
16
|
+
%p
|
17
|
+
%q>
|
18
|
+
= "Foo"
|
19
|
+
%p
|
20
|
+
%p
|
21
|
+
%q{:a => 1 + 1}>
|
22
|
+
= "Foo"
|
23
|
+
%p
|
24
|
+
%p
|
25
|
+
%q>= "Foo"
|
26
|
+
%p
|
27
|
+
%p
|
28
|
+
%q{:a => 1 + 1}>= "Foo"
|
29
|
+
%p
|
30
|
+
%p
|
31
|
+
%q>
|
32
|
+
= "Foo\nBar"
|
33
|
+
%p
|
34
|
+
%p
|
35
|
+
%q{:a => 1 + 1}>
|
36
|
+
= "Foo\nBar"
|
37
|
+
%p
|
38
|
+
%p
|
39
|
+
%q>= "Foo\nBar"
|
40
|
+
%p
|
41
|
+
%p
|
42
|
+
%q{:a => 1 + 1}>= "Foo\nBar"
|
43
|
+
%p
|
44
|
+
%p
|
45
|
+
- tab_up
|
46
|
+
foo
|
47
|
+
%q>
|
48
|
+
Foo
|
49
|
+
bar
|
50
|
+
- tab_down
|
51
|
+
%p
|
52
|
+
%p
|
53
|
+
- tab_up
|
54
|
+
foo
|
55
|
+
%q{:a => 1 + 1}>
|
56
|
+
Foo
|
57
|
+
bar
|
58
|
+
- tab_down
|
59
|
+
%p
|
60
|
+
%p
|
61
|
+
- tab_up
|
62
|
+
foo
|
63
|
+
%q> Foo
|
64
|
+
bar
|
65
|
+
- tab_down
|
66
|
+
%p
|
67
|
+
%p
|
68
|
+
- tab_up
|
69
|
+
foo
|
70
|
+
%q{:a => 1 + 1}> Foo
|
71
|
+
bar
|
72
|
+
- tab_down
|
73
|
+
%p
|
74
|
+
%p
|
75
|
+
- tab_up
|
76
|
+
foo
|
77
|
+
%q>
|
78
|
+
= "Foo"
|
79
|
+
bar
|
80
|
+
- tab_down
|
81
|
+
%p
|
82
|
+
%p
|
83
|
+
- tab_up
|
84
|
+
foo
|
85
|
+
%q{:a => 1 + 1}>
|
86
|
+
= "Foo"
|
87
|
+
bar
|
88
|
+
- tab_down
|
89
|
+
%p
|
90
|
+
%p
|
91
|
+
- tab_up
|
92
|
+
foo
|
93
|
+
%q>= "Foo"
|
94
|
+
bar
|
95
|
+
- tab_down
|
96
|
+
%p
|
97
|
+
%p
|
98
|
+
- tab_up
|
99
|
+
foo
|
100
|
+
%q{:a => 1 + 1}>= "Foo"
|
101
|
+
bar
|
102
|
+
- tab_down
|
103
|
+
%p
|
104
|
+
%p
|
105
|
+
- tab_up
|
106
|
+
foo
|
107
|
+
%q>
|
108
|
+
= "Foo\nBar"
|
109
|
+
bar
|
110
|
+
- tab_down
|
111
|
+
%p
|
112
|
+
%p
|
113
|
+
- tab_up
|
114
|
+
foo
|
115
|
+
%q{:a => 1 + 1}>
|
116
|
+
= "Foo\nBar"
|
117
|
+
bar
|
118
|
+
- tab_down
|
119
|
+
%p
|
120
|
+
%p
|
121
|
+
- tab_up
|
122
|
+
foo
|
123
|
+
%q>= "Foo\nBar"
|
124
|
+
bar
|
125
|
+
- tab_down
|
126
|
+
%p
|
127
|
+
%p
|
128
|
+
- tab_up
|
129
|
+
foo
|
130
|
+
%q{:a => 1 + 1}>= "Foo\nBar"
|
131
|
+
bar
|
132
|
+
- tab_down
|
133
|
+
%p
|
134
|
+
%p
|
135
|
+
%q>
|
136
|
+
%p
|
137
|
+
%p
|
138
|
+
%q>/
|
139
|
+
%p
|
140
|
+
%p
|
141
|
+
%q{:a => 1 + 1}>
|
142
|
+
%p
|
143
|
+
%p
|
144
|
+
%q{:a => 1 + 1}>/
|
@@ -0,0 +1,17 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title Stop. haml time
|
5
|
+
#content
|
6
|
+
%h1 This is a title!
|
7
|
+
%p Lorem ipsum dolor sit amet, consectetur adipisicing elit
|
8
|
+
%p{:class => 'foo'} Cigarettes!
|
9
|
+
%h2 Man alive!
|
10
|
+
%ul.things
|
11
|
+
%li Slippers
|
12
|
+
%li Shoes
|
13
|
+
%li Bathrobe
|
14
|
+
%li Coffee
|
15
|
+
%pre
|
16
|
+
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?
|
@@ -0,0 +1 @@
|
|
1
|
+
= render :file => "#{name}.haml"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
%div
|
2
|
+
%h1 I can count!
|
3
|
+
- (1..20).each do |i|
|
4
|
+
= i
|
5
|
+
%h1 I know my ABCs!
|
6
|
+
%ul
|
7
|
+
- ('a'..'z').each do |i|
|
8
|
+
%li= i
|
9
|
+
%h1 I can catch errors!
|
10
|
+
- begin
|
11
|
+
- String.silly
|
12
|
+
- rescue NameError => e
|
13
|
+
= "Oh no! \"#{e}\" happened!"
|
14
|
+
%p
|
15
|
+
"false" is:
|
16
|
+
- if false
|
17
|
+
= "true"
|
18
|
+
- else
|
19
|
+
= "false"
|
20
|
+
- if true
|
21
|
+
- 5.times do |i|
|
22
|
+
- if i % 2 == 1
|
23
|
+
Odd!
|
24
|
+
- else
|
25
|
+
Even!
|
26
|
+
- else
|
27
|
+
= "This can't happen!"
|
28
|
+
- 13 |
|
29
|
+
.foo
|
30
|
+
%strong foobar
|
31
|
+
- 5.times |
|
32
|
+
do |
|
33
|
+
|a| |
|
34
|
+
%strong= a
|
35
|
+
.test
|
36
|
+
- "foo |
|
37
|
+
bar |
|
38
|
+
baz" |
|
39
|
+
|
40
|
+
%p boom
|
@@ -0,0 +1,42 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en-US", "lang" => "en-US"}
|
3
|
+
%head
|
4
|
+
%title Hampton Catlin Is Totally Awesome
|
5
|
+
%meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
|
6
|
+
%body
|
7
|
+
/ You're In my house now!
|
8
|
+
.header
|
9
|
+
Yes, ladies and gentileman. He is just that egotistical.
|
10
|
+
Fantastic! This should be multi-line output
|
11
|
+
The question is if this would translate! Ahah!
|
12
|
+
= 1 + 9 + 8 + 2 #numbers should work and this should be ignored
|
13
|
+
#body= " Quotes should be loved! Just like people!"
|
14
|
+
- 120.times do |number|
|
15
|
+
= number
|
16
|
+
Wow.|
|
17
|
+
%p
|
18
|
+
= "Holy cow " + |
|
19
|
+
"multiline " + |
|
20
|
+
"tags! " + |
|
21
|
+
"A pipe (|) even!" |
|
22
|
+
= [1, 2, 3].collect { |n| "PipesIgnored|" }.join
|
23
|
+
= [1, 2, 3].collect { |n| |
|
24
|
+
n.to_s |
|
25
|
+
}.join("|") |
|
26
|
+
%div.silent
|
27
|
+
- foo = String.new
|
28
|
+
- foo << "this"
|
29
|
+
- foo << " shouldn't"
|
30
|
+
- foo << " evaluate"
|
31
|
+
= foo + " but now it should!"
|
32
|
+
-# Woah crap a comment!
|
33
|
+
|
34
|
+
-# That was a line that shouldn't close everything.
|
35
|
+
%ul.really.cool
|
36
|
+
- ('a'..'f').each do |a|
|
37
|
+
%li= a
|
38
|
+
#combo.of_divs_with_underscore= @should_eval = "with this text"
|
39
|
+
= "foo".each_line do |line|
|
40
|
+
- nil
|
41
|
+
.footer
|
42
|
+
%strong.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. \nSo, I'm just making it *really* long. God, I hope this works"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en-US", "lang" => "en-US"}
|
3
|
+
%head
|
4
|
+
%title Hampton Catlin Is Totally Awesome
|
5
|
+
%meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
|
6
|
+
%body
|
7
|
+
/ You're In my house now!
|
8
|
+
.header
|
9
|
+
Yes, ladies and gentileman. He is just that egotistical.
|
10
|
+
Fantastic! This should be multi-line output
|
11
|
+
The question is if this would translate! Ahah!
|
12
|
+
= 1 + 9 + 8 + 2 #numbers should work and this should be ignored
|
13
|
+
#body= " Quotes should be loved! Just like people!"
|
14
|
+
- 120.times do |number|
|
15
|
+
= number
|
16
|
+
Wow.|
|
17
|
+
%p
|
18
|
+
= "Holy cow " + |
|
19
|
+
"multiline " + |
|
20
|
+
"tags! " + |
|
21
|
+
"A pipe (|) even!" |
|
22
|
+
= [1, 2, 3].collect { |n| "PipesIgnored|" }.join
|
23
|
+
= [1, 2, 3].collect { |n| |
|
24
|
+
n.to_s |
|
25
|
+
}.join("|") |
|
26
|
+
%div.silent
|
27
|
+
- foo = String.new
|
28
|
+
- foo << "this"
|
29
|
+
- foo << " shouldn't"
|
30
|
+
- foo << " evaluate"
|
31
|
+
= foo + " but now it should!"
|
32
|
+
-# Woah crap a comment!
|
33
|
+
|
34
|
+
-# That was a line that shouldn't close everything.
|
35
|
+
%ul.really.cool
|
36
|
+
- ('a'..'f').each do |a|
|
37
|
+
%li= a
|
38
|
+
#combo.of_divs_with_underscore= @should_eval = "with this text"
|
39
|
+
= "foo".each_line do |line|
|
40
|
+
- nil
|
41
|
+
.footer
|
42
|
+
%strong.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. \nSo, I'm just making it *really* long. God, I hope this works"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
%div.tags
|
2
|
+
%foo 1
|
3
|
+
%FOO 2
|
4
|
+
%fooBAR 3
|
5
|
+
%fooBar 4
|
6
|
+
%foo_bar 5
|
7
|
+
%foo-bar 6
|
8
|
+
%foo:bar 7
|
9
|
+
%foo.bar 8
|
10
|
+
%fooBAr_baz:boom_bar 9
|
11
|
+
%foo13 10
|
12
|
+
%foo2u 11
|
13
|
+
%div.classes
|
14
|
+
%p.foo.bar#baz#boom
|
15
|
+
.fooBar a
|
16
|
+
.foo-bar b
|
17
|
+
.foo_bar c
|
18
|
+
.FOOBAR d
|
19
|
+
.foo16 e
|
20
|
+
.123 f
|
21
|
+
.foo2u g
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#whitespace_test
|
2
|
+
= test_partial "text_area", :value => "Oneline"
|
3
|
+
= test_partial "text_area", :value => "Two\nlines"
|
4
|
+
~ test_partial "text_area", :value => "Oneline"
|
5
|
+
~ test_partial "text_area", :value => "Two\nlines"
|
6
|
+
#flattened~ test_partial "text_area", :value => "Two\nlines"
|
7
|
+
.hithere
|
8
|
+
~ "Foo bar"
|
9
|
+
~ "<pre>foo bar</pre>"
|
10
|
+
~ "<pre>foo\nbar</pre>"
|
11
|
+
%p~ "<pre>foo\nbar</pre>"
|
12
|
+
%p~ "foo\nbar"
|
13
|
+
.foo
|
14
|
+
~ 13
|
15
|
+
~ "<textarea>\na\n</textarea>".each_line do |l|
|
16
|
+
- haml_concat l.strip
|
17
|
+
#whitespace_test
|
18
|
+
= test_partial "text_area", :value => "Oneline"
|
19
|
+
= test_partial "text_area", :value => "Two\nlines"
|
20
|
+
= find_and_preserve test_partial("text_area", :value => "Oneline")
|
21
|
+
= find_and_preserve test_partial("text_area", :value => "Two\nlines")
|
22
|
+
#flattened= find_and_preserve test_partial("text_area", :value => "Two\nlines")
|
23
|
+
.hithere
|
24
|
+
= find_and_preserve("Foo bar")
|
25
|
+
= find_and_preserve("<pre>foo bar</pre>")
|
26
|
+
= find_and_preserve("<pre>foo\nbar</pre>")
|
27
|
+
%p= find_and_preserve("<pre>foo\nbar</pre>")
|
28
|
+
%p= find_and_preserve("foo\nbar")
|
29
|
+
%pre
|
30
|
+
:preserve
|
31
|
+
___
|
32
|
+
,o88888
|
33
|
+
,o8888888'
|
34
|
+
,:o:o:oooo. ,8O88Pd8888"
|
35
|
+
,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
|
36
|
+
,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
|
37
|
+
, ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
|
38
|
+
, ..:.::o:ooOoOO8O888O8O,COCOO"
|
39
|
+
, . ..:.::o:ooOoOOOO8OOOOCOCO"
|
40
|
+
. ..:.::o:ooOoOoOO8O8OCCCC"o
|
41
|
+
. ..:.::o:ooooOoCoCCC"o:o
|
42
|
+
. ..:.::o:o:,cooooCo"oo:o:
|
43
|
+
` . . ..:.:cocoooo"'o:o:::'
|
44
|
+
.` . ..::ccccoc"'o:o:o:::'
|
45
|
+
:.:. ,c:cccc"':.:.:.:.:.'
|
46
|
+
..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
|
47
|
+
...:.'.:.::::"' . . . . .'
|
48
|
+
.. . ....:."' ` . . . ''
|
49
|
+
. . . ...."'
|
50
|
+
.. . ."' -hrr-
|
51
|
+
.
|
52
|
+
|
53
|
+
|
54
|
+
It's a planet!
|
55
|
+
%strong This shouldn't be bold!
|
56
|
+
%strong This should!
|
57
|
+
%textarea
|
58
|
+
:preserve
|
59
|
+
___ ___ ___ ___
|
60
|
+
/\__\ /\ \ /\__\ /\__\
|
61
|
+
/:/ / /::\ \ /::| | /:/ /
|
62
|
+
/:/__/ /:/\:\ \ /:|:| | /:/ /
|
63
|
+
/::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
|
64
|
+
/:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
|
65
|
+
\/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
|
66
|
+
\::/ / \::/ / /:/ / \:\ \
|
67
|
+
/:/ / /:/ / /:/ / \:\ \
|
68
|
+
/:/ / /:/ / /:/ / \:\__\
|
69
|
+
\/__/ \/__/ \/__/ \/__/
|
70
|
+
|
71
|
+
Many
|
72
|
+
thanks
|
73
|
+
to
|
74
|
+
http://www.network-science.de/ascii/
|
75
|
+
%strong indeed!
|
76
|
+
.foo
|
77
|
+
= find_and_preserve(13)
|
78
|
+
%pre
|
79
|
+
:preserve
|
80
|
+
__ ______ __ ______
|
81
|
+
.----.| |--.|__ |.----.| |--..--------.| __ |
|
82
|
+
| __|| ||__ || __|| < | || __ |
|
83
|
+
|____||__|__||______||____||__|__||__|__|__||______|
|
84
|
+
%pre
|
85
|
+
:preserve
|
86
|
+
foo
|
87
|
+
bar
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
|
+
|
4
|
+
class UtilTest < Test::Unit::TestCase
|
5
|
+
include Haml::Util
|
6
|
+
|
7
|
+
def test_to_hash
|
8
|
+
assert_equal({
|
9
|
+
:foo => 1,
|
10
|
+
:bar => 2,
|
11
|
+
:baz => 3
|
12
|
+
}, to_hash([[:foo, 1], [:bar, 2], [:baz, 3]]))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_map_keys
|
16
|
+
assert_equal({
|
17
|
+
"foo" => 1,
|
18
|
+
"bar" => 2,
|
19
|
+
"baz" => 3
|
20
|
+
}, map_keys({:foo => 1, :bar => 2, :baz => 3}) {|k| k.to_s})
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_map_vals
|
24
|
+
assert_equal({
|
25
|
+
:foo => "1",
|
26
|
+
:bar => "2",
|
27
|
+
:baz => "3"
|
28
|
+
}, map_vals({:foo => 1, :bar => 2, :baz => 3}) {|k| k.to_s})
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_map_hash
|
32
|
+
assert_equal({
|
33
|
+
"foo" => "1",
|
34
|
+
"bar" => "2",
|
35
|
+
"baz" => "3"
|
36
|
+
}, map_hash({:foo => 1, :bar => 2, :baz => 3}) {|k, v| [k.to_s, v.to_s]})
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_powerset
|
40
|
+
return unless Set[Set[]] == Set[Set[]] # There's a bug in Ruby 1.8.6 that breaks nested set equality
|
41
|
+
assert_equal([[].to_set].to_set,
|
42
|
+
powerset([]))
|
43
|
+
assert_equal([[].to_set, [1].to_set].to_set,
|
44
|
+
powerset([1]))
|
45
|
+
assert_equal([[].to_set, [1].to_set, [2].to_set, [1, 2].to_set].to_set,
|
46
|
+
powerset([1, 2]))
|
47
|
+
assert_equal([[].to_set, [1].to_set, [2].to_set, [3].to_set,
|
48
|
+
[1, 2].to_set, [2, 3].to_set, [1, 3].to_set, [1, 2, 3].to_set].to_set,
|
49
|
+
powerset([1, 2, 3]))
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_has
|
53
|
+
assert(has?(:instance_method, String, :chomp!))
|
54
|
+
assert(has?(:private_instance_method, Haml::Engine, :set_locals))
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_enum_with_index
|
58
|
+
assert_equal(%w[foo0 bar1 baz2],
|
59
|
+
enum_with_index(%w[foo bar baz]).map {|s, i| "#{s}#{i}"})
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_def_static_method
|
63
|
+
klass = Class.new
|
64
|
+
def_static_method(klass, :static_method, [:arg1, :arg2],
|
65
|
+
:sarg1, :sarg2, <<RUBY)
|
66
|
+
s = "Always " + arg1
|
67
|
+
s << " <% if sarg1 %>and<% else %>but never<% end %> " << arg2
|
68
|
+
|
69
|
+
<% if sarg2 %>
|
70
|
+
s << "."
|
71
|
+
<% end %>
|
72
|
+
RUBY
|
73
|
+
c = klass.new
|
74
|
+
assert_equal("Always brush your teeth and comb your hair.",
|
75
|
+
c.send(static_method_name(:static_method, true, true),
|
76
|
+
"brush your teeth", "comb your hair"))
|
77
|
+
assert_equal("Always brush your teeth and comb your hair",
|
78
|
+
c.send(static_method_name(:static_method, true, false),
|
79
|
+
"brush your teeth", "comb your hair"))
|
80
|
+
assert_equal("Always brush your teeth but never play with fire.",
|
81
|
+
c.send(static_method_name(:static_method, false, true),
|
82
|
+
"brush your teeth", "play with fire"))
|
83
|
+
assert_equal("Always brush your teeth but never play with fire",
|
84
|
+
c.send(static_method_name(:static_method, false, false),
|
85
|
+
"brush your teeth", "play with fire"))
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# allows testing with edge Rails by creating a test/rails symlink
|
2
|
+
linked_rails = File.dirname(__FILE__) + '/rails'
|
3
|
+
|
4
|
+
if File.exists?(linked_rails) && !$:.include?(linked_rails + '/activesupport/lib')
|
5
|
+
puts "[ using linked Rails ]"
|
6
|
+
$:.unshift linked_rails + '/activesupport/lib'
|
7
|
+
$:.unshift linked_rails + '/actionpack/lib'
|
8
|
+
else
|
9
|
+
require 'rubygems'
|
10
|
+
end
|
11
|
+
require 'action_controller'
|
12
|
+
require 'action_view'
|