haml-edge 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/EDGE_GEM_VERSION +1 -0
  2. data/FAQ +138 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +332 -0
  5. data/REVISION +1 -0
  6. data/Rakefile +226 -0
  7. data/VERSION +1 -0
  8. data/bin/css2sass +7 -0
  9. data/bin/haml +9 -0
  10. data/bin/html2haml +7 -0
  11. data/bin/sass +8 -0
  12. data/extra/edge_gem_watch.rb +13 -0
  13. data/extra/haml-mode.el +596 -0
  14. data/extra/sass-mode.el +200 -0
  15. data/init.rb +8 -0
  16. data/lib/haml/buffer.rb +255 -0
  17. data/lib/haml/engine.rb +268 -0
  18. data/lib/haml/error.rb +22 -0
  19. data/lib/haml/exec.rb +395 -0
  20. data/lib/haml/filters.rb +275 -0
  21. data/lib/haml/helpers/action_view_extensions.rb +45 -0
  22. data/lib/haml/helpers/action_view_mods.rb +181 -0
  23. data/lib/haml/helpers.rb +488 -0
  24. data/lib/haml/html.rb +222 -0
  25. data/lib/haml/precompiler.rb +904 -0
  26. data/lib/haml/shared.rb +45 -0
  27. data/lib/haml/template/patch.rb +58 -0
  28. data/lib/haml/template/plugin.rb +72 -0
  29. data/lib/haml/template.rb +42 -0
  30. data/lib/haml/util.rb +88 -0
  31. data/lib/haml/version.rb +47 -0
  32. data/lib/haml.rb +1044 -0
  33. data/lib/sass/css.rb +388 -0
  34. data/lib/sass/engine.rb +495 -0
  35. data/lib/sass/environment.rb +46 -0
  36. data/lib/sass/error.rb +35 -0
  37. data/lib/sass/plugin/merb.rb +56 -0
  38. data/lib/sass/plugin/rails.rb +24 -0
  39. data/lib/sass/plugin.rb +204 -0
  40. data/lib/sass/repl.rb +51 -0
  41. data/lib/sass/script/bool.rb +13 -0
  42. data/lib/sass/script/color.rb +97 -0
  43. data/lib/sass/script/funcall.rb +29 -0
  44. data/lib/sass/script/functions.rb +134 -0
  45. data/lib/sass/script/lexer.rb +148 -0
  46. data/lib/sass/script/literal.rb +82 -0
  47. data/lib/sass/script/number.rb +231 -0
  48. data/lib/sass/script/operation.rb +30 -0
  49. data/lib/sass/script/parser.rb +142 -0
  50. data/lib/sass/script/string.rb +9 -0
  51. data/lib/sass/script/unary_operation.rb +21 -0
  52. data/lib/sass/script/variable.rb +20 -0
  53. data/lib/sass/script.rb +38 -0
  54. data/lib/sass/tree/attr_node.rb +64 -0
  55. data/lib/sass/tree/comment_node.rb +30 -0
  56. data/lib/sass/tree/debug_node.rb +22 -0
  57. data/lib/sass/tree/directive_node.rb +50 -0
  58. data/lib/sass/tree/file_node.rb +27 -0
  59. data/lib/sass/tree/for_node.rb +29 -0
  60. data/lib/sass/tree/if_node.rb +27 -0
  61. data/lib/sass/tree/mixin_def_node.rb +18 -0
  62. data/lib/sass/tree/mixin_node.rb +35 -0
  63. data/lib/sass/tree/node.rb +99 -0
  64. data/lib/sass/tree/rule_node.rb +161 -0
  65. data/lib/sass/tree/variable_node.rb +24 -0
  66. data/lib/sass/tree/while_node.rb +21 -0
  67. data/lib/sass.rb +1062 -0
  68. data/rails/init.rb +1 -0
  69. data/test/benchmark.rb +99 -0
  70. data/test/haml/engine_test.rb +795 -0
  71. data/test/haml/helper_test.rb +228 -0
  72. data/test/haml/html2haml_test.rb +108 -0
  73. data/test/haml/markaby/standard.mab +52 -0
  74. data/test/haml/mocks/article.rb +6 -0
  75. data/test/haml/results/content_for_layout.xhtml +15 -0
  76. data/test/haml/results/eval_suppressed.xhtml +9 -0
  77. data/test/haml/results/filters.xhtml +62 -0
  78. data/test/haml/results/helpers.xhtml +93 -0
  79. data/test/haml/results/helpful.xhtml +10 -0
  80. data/test/haml/results/just_stuff.xhtml +68 -0
  81. data/test/haml/results/list.xhtml +12 -0
  82. data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  83. data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  84. data/test/haml/results/original_engine.xhtml +20 -0
  85. data/test/haml/results/partial_layout.xhtml +5 -0
  86. data/test/haml/results/partials.xhtml +21 -0
  87. data/test/haml/results/render_layout.xhtml +3 -0
  88. data/test/haml/results/silent_script.xhtml +74 -0
  89. data/test/haml/results/standard.xhtml +162 -0
  90. data/test/haml/results/tag_parsing.xhtml +23 -0
  91. data/test/haml/results/very_basic.xhtml +5 -0
  92. data/test/haml/results/whitespace_handling.xhtml +89 -0
  93. data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
  94. data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
  95. data/test/haml/rhtml/action_view.rhtml +62 -0
  96. data/test/haml/rhtml/standard.rhtml +54 -0
  97. data/test/haml/template_test.rb +204 -0
  98. data/test/haml/templates/_av_partial_1.haml +9 -0
  99. data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
  100. data/test/haml/templates/_av_partial_2.haml +5 -0
  101. data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
  102. data/test/haml/templates/_layout.erb +3 -0
  103. data/test/haml/templates/_layout_for_partial.haml +3 -0
  104. data/test/haml/templates/_partial.haml +8 -0
  105. data/test/haml/templates/_text_area.haml +3 -0
  106. data/test/haml/templates/action_view.haml +47 -0
  107. data/test/haml/templates/action_view_ugly.haml +47 -0
  108. data/test/haml/templates/breakage.haml +8 -0
  109. data/test/haml/templates/content_for_layout.haml +10 -0
  110. data/test/haml/templates/eval_suppressed.haml +11 -0
  111. data/test/haml/templates/filters.haml +66 -0
  112. data/test/haml/templates/helpers.haml +95 -0
  113. data/test/haml/templates/helpful.haml +11 -0
  114. data/test/haml/templates/just_stuff.haml +83 -0
  115. data/test/haml/templates/list.haml +12 -0
  116. data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  117. data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  118. data/test/haml/templates/original_engine.haml +17 -0
  119. data/test/haml/templates/partial_layout.haml +3 -0
  120. data/test/haml/templates/partialize.haml +1 -0
  121. data/test/haml/templates/partials.haml +12 -0
  122. data/test/haml/templates/render_layout.haml +2 -0
  123. data/test/haml/templates/silent_script.haml +40 -0
  124. data/test/haml/templates/standard.haml +42 -0
  125. data/test/haml/templates/standard_ugly.haml +42 -0
  126. data/test/haml/templates/tag_parsing.haml +21 -0
  127. data/test/haml/templates/very_basic.haml +4 -0
  128. data/test/haml/templates/whitespace_handling.haml +87 -0
  129. data/test/haml/util_test.rb +87 -0
  130. data/test/linked_rails.rb +12 -0
  131. data/test/sass/css2sass_test.rb +193 -0
  132. data/test/sass/engine_test.rb +709 -0
  133. data/test/sass/functions_test.rb +109 -0
  134. data/test/sass/more_results/more1.css +9 -0
  135. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  136. data/test/sass/more_results/more_import.css +29 -0
  137. data/test/sass/more_templates/_more_partial.sass +2 -0
  138. data/test/sass/more_templates/more1.sass +23 -0
  139. data/test/sass/more_templates/more_import.sass +11 -0
  140. data/test/sass/plugin_test.rb +213 -0
  141. data/test/sass/results/alt.css +4 -0
  142. data/test/sass/results/basic.css +9 -0
  143. data/test/sass/results/compact.css +5 -0
  144. data/test/sass/results/complex.css +87 -0
  145. data/test/sass/results/compressed.css +1 -0
  146. data/test/sass/results/expanded.css +19 -0
  147. data/test/sass/results/import.css +29 -0
  148. data/test/sass/results/line_numbers.css +49 -0
  149. data/test/sass/results/mixins.css +95 -0
  150. data/test/sass/results/multiline.css +24 -0
  151. data/test/sass/results/nested.css +22 -0
  152. data/test/sass/results/parent_ref.css +13 -0
  153. data/test/sass/results/script.css +16 -0
  154. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  155. data/test/sass/results/subdir/subdir.css +3 -0
  156. data/test/sass/results/units.css +11 -0
  157. data/test/sass/script_test.rb +250 -0
  158. data/test/sass/templates/_partial.sass +2 -0
  159. data/test/sass/templates/alt.sass +16 -0
  160. data/test/sass/templates/basic.sass +23 -0
  161. data/test/sass/templates/bork.sass +2 -0
  162. data/test/sass/templates/bork2.sass +2 -0
  163. data/test/sass/templates/compact.sass +17 -0
  164. data/test/sass/templates/complex.sass +309 -0
  165. data/test/sass/templates/compressed.sass +15 -0
  166. data/test/sass/templates/expanded.sass +17 -0
  167. data/test/sass/templates/import.sass +11 -0
  168. data/test/sass/templates/importee.sass +19 -0
  169. data/test/sass/templates/line_numbers.sass +13 -0
  170. data/test/sass/templates/mixins.sass +76 -0
  171. data/test/sass/templates/multiline.sass +20 -0
  172. data/test/sass/templates/nested.sass +25 -0
  173. data/test/sass/templates/parent_ref.sass +25 -0
  174. data/test/sass/templates/script.sass +101 -0
  175. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  176. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  177. data/test/sass/templates/subdir/subdir.sass +6 -0
  178. data/test/sass/templates/units.sass +11 -0
  179. data/test/test_helper.rb +21 -0
  180. metadata +278 -0
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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</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
+ <%= 1 + 9 + 8 + 2 %>
14
+ <%# numbers should work and this should be ignored %>
15
+ </div>
16
+ <% 120.times do |number| -%>
17
+ <%= number %>
18
+ <% end -%>
19
+ <div id='body'><%= " Quotes should be loved! Just like people!" %></div>
20
+ Wow.
21
+ <p>
22
+ <%= "Holy cow " +
23
+ "multiline " +
24
+ "tags! " +
25
+ "A pipe (|) even!" %>
26
+ <%= [1, 2, 3].collect { |n| "PipesIgnored|" }.join %>
27
+ <%= [1, 2, 3].collect { |n|
28
+ n.to_s
29
+ }.join("|") %>
30
+ </p>
31
+ <div class='silent'>
32
+ <% foo = String.new
33
+ foo << "this"
34
+ foo << " shouldn't"
35
+ foo << " evaluate" %>
36
+ <%= foo + "but now it should!" %>
37
+ <%# Woah crap a comment! %>
38
+ </div>
39
+ <ul class='really cool'>
40
+ <% ('a'..'f').each do |a|%>
41
+ <li><%= a %></li>
42
+ <% end %>
43
+ <div class='of_divs_with_underscore' id='combo'><%= @should_eval = "with this text" %></div>
44
+ <%= "foo".each_line do |line|
45
+ nil
46
+ end %>
47
+ <div class='footer'>
48
+ <strong class='shout'>
49
+ <%= "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.\n" +
50
+ " So, I'm just making it *really* long. God, I hope this works" %>
51
+ </strong>
52
+ </div>
53
+ </body>
54
+ </html>
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+ require 'haml/template'
4
+ require 'sass/plugin'
5
+ require File.dirname(__FILE__) + '/mocks/article'
6
+
7
+ require 'action_pack/version'
8
+
9
+ module Haml::Filters::Test
10
+ include Haml::Filters::Base
11
+
12
+ def render(text)
13
+ "TESTING HAHAHAHA!"
14
+ end
15
+ end
16
+
17
+ module Haml::Helpers
18
+ def test_partial(name, locals = {})
19
+ Haml::Engine.new(File.read(File.join(TemplateTest::TEMPLATE_PATH, "_#{name}.haml"))).render(self, locals)
20
+ end
21
+ end
22
+
23
+ class Egocentic
24
+ def method_missing(*args)
25
+ self
26
+ end
27
+ end
28
+
29
+ class DummyController
30
+ attr_accessor :logger
31
+ def initialize
32
+ @logger = Egocentic.new
33
+ end
34
+
35
+ def self.controller_path
36
+ ''
37
+ end
38
+ end
39
+
40
+ class TemplateTest < Test::Unit::TestCase
41
+ TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
42
+ TEMPLATES = %w{ very_basic standard helpers
43
+ whitespace_handling original_engine list helpful
44
+ silent_script tag_parsing just_stuff partials
45
+ filters nuke_outer_whitespace nuke_inner_whitespace
46
+ render_layout }
47
+ # partial layouts were introduced in 2.0.0
48
+ TEMPLATES << 'partial_layout' unless ActionPack::VERSION::MAJOR < 2
49
+
50
+ def setup
51
+ @base = create_base
52
+
53
+ # filters template uses :sass
54
+ Sass::Plugin.options.update(:line_comments => true, :style => :compact)
55
+ end
56
+
57
+ def create_base
58
+ vars = { 'article' => Article.new, 'foo' => 'value one' }
59
+
60
+ unless Haml::Util.has?(:instance_method, ActionView::Base, :finder)
61
+ base = ActionView::Base.new(TEMPLATE_PATH, vars)
62
+ else
63
+ # Rails 2.1.0
64
+ base = ActionView::Base.new([], vars)
65
+ base.finder.append_view_path(TEMPLATE_PATH)
66
+ end
67
+
68
+ if Haml::Util.has?(:private_method, base, :evaluate_assigns)
69
+ base.send(:evaluate_assigns)
70
+ else
71
+ # Rails 2.2
72
+ base.send(:_evaluate_assigns_and_ivars)
73
+ end
74
+
75
+ # This is used by form_for.
76
+ # It's usually provided by ActionController::Base.
77
+ def base.protect_against_forgery?; false; end
78
+
79
+ base.controller = DummyController.new
80
+ base
81
+ end
82
+
83
+ def render(text)
84
+ Haml::Engine.new(text).to_html(@base)
85
+ end
86
+
87
+ def load_result(name)
88
+ @result = ''
89
+ File.new(File.dirname(__FILE__) + "/results/#{name}.xhtml").each_line { |l| @result += l }
90
+ @result
91
+ end
92
+
93
+ def assert_renders_correctly(name, &render_method)
94
+ if ActionPack::VERSION::MAJOR < 2 || ActionPack::VERSION::MINOR < 2
95
+ render_method ||= proc { |name| @base.render(name) }
96
+ else
97
+ render_method ||= proc { |name| @base.render(:file => name) }
98
+ end
99
+
100
+ load_result(name).split("\n").zip(render_method[name].split("\n")).each_with_index do |pair, line|
101
+ message = "template: #{name}\nline: #{line}"
102
+ assert_equal(pair.first, pair.last, message)
103
+ end
104
+ rescue ActionView::TemplateError => e
105
+ if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
106
+ puts "\nCouldn't require #{$2}; skipping a test."
107
+ else
108
+ raise e
109
+ end
110
+ end
111
+
112
+ def test_empty_render_should_remain_empty
113
+ assert_equal('', render(''))
114
+ end
115
+
116
+ TEMPLATES.each do |template|
117
+ define_method "test_template_should_render_correctly [template: #{template}] " do
118
+ assert_renders_correctly template
119
+ end
120
+ end
121
+
122
+ def test_templates_should_render_correctly_with_render_proc
123
+ assert_renders_correctly("standard") do |name|
124
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
125
+ engine.render_proc(@base).call
126
+ end
127
+ end
128
+
129
+ def test_templates_should_render_correctly_with_def_method
130
+ assert_renders_correctly("standard") do |name|
131
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
132
+ engine.def_method(@base, "render_standard")
133
+ @base.render_standard
134
+ end
135
+ end
136
+
137
+ def test_action_view_templates_render_correctly
138
+ @base.instance_variable_set("@content_for_layout", 'Lorem ipsum dolor sit amet')
139
+ assert_renders_correctly 'content_for_layout'
140
+ end
141
+
142
+ def test_instance_variables_should_work_inside_templates
143
+ @base.instance_variable_set("@content_for_layout", 'something')
144
+ assert_equal("<p>something</p>", render("%p= @content_for_layout").chomp)
145
+
146
+ @base.instance_eval("@author = 'Hampton Catlin'")
147
+ assert_equal("<div class='author'>Hampton Catlin</div>", render(".author= @author").chomp)
148
+
149
+ @base.instance_eval("@author = 'Hampton'")
150
+ assert_equal("Hampton", render("= @author").chomp)
151
+
152
+ @base.instance_eval("@author = 'Catlin'")
153
+ assert_equal("Catlin", render("= @author").chomp)
154
+ end
155
+
156
+ def test_instance_variables_should_work_inside_attributes
157
+ @base.instance_eval("@author = 'hcatlin'")
158
+ assert_equal("<p class='hcatlin'>foo</p>", render("%p{:class => @author} foo").chomp)
159
+ end
160
+
161
+ def test_template_renders_should_eval
162
+ assert_equal("2\n", render("= 1+1"))
163
+ end
164
+
165
+ def test_haml_options
166
+ Haml::Template.options = { :suppress_eval => true }
167
+ assert_equal({ :suppress_eval => true }, Haml::Template.options)
168
+ old_base, @base = @base, create_base
169
+ assert_renders_correctly("eval_suppressed")
170
+ @base = old_base
171
+ Haml::Template.options = {}
172
+ end
173
+
174
+ def test_exceptions_should_work_correctly
175
+ begin
176
+ render("- raise 'oops!'")
177
+ rescue Exception => e
178
+ assert_equal("oops!", e.message)
179
+ assert_match(/^\(haml\):1/, e.backtrace[0])
180
+ else
181
+ assert false
182
+ end
183
+
184
+ template = <<END
185
+ %p
186
+ %h1 Hello!
187
+ = "lots of lines"
188
+ = "even more!"
189
+ - raise 'oh no!'
190
+ %p
191
+ this is after the exception
192
+ %strong yes it is!
193
+ ho ho ho.
194
+ END
195
+
196
+ begin
197
+ render(template.chomp)
198
+ rescue Exception => e
199
+ assert_match(/^\(haml\):5/, e.backtrace[0])
200
+ else
201
+ assert false
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,9 @@
1
+ %h2 This is a pretty complicated partial
2
+ .partial
3
+ %p It has several nested partials,
4
+ %ul
5
+ - 5.times do
6
+ %li
7
+ %strong Partial:
8
+ - @nesting = 5
9
+ = render :partial => 'haml/templates/av_partial_2'
@@ -0,0 +1,9 @@
1
+ %h2 This is a pretty complicated partial
2
+ .partial
3
+ %p It has several nested partials,
4
+ %ul
5
+ - 5.times do
6
+ %li
7
+ %strong Partial:
8
+ - @nesting = 5
9
+ = render :partial => 'haml/templates/av_partial_2_ugly'
@@ -0,0 +1,5 @@
1
+ - @nesting -= 1
2
+ .partial{:level => @nesting}
3
+ %h3 This is a crazy deep-nested partial.
4
+ %p== Nesting level #{@nesting}
5
+ = render :partial => 'haml/templates/av_partial_2' if @nesting > 0
@@ -0,0 +1,5 @@
1
+ - @nesting -= 1
2
+ .partial{:level => @nesting}
3
+ %h3 This is a crazy deep-nested partial.
4
+ %p== Nesting level #{@nesting}
5
+ = render :partial => 'haml/templates/av_partial_2_ugly' if @nesting > 0
@@ -0,0 +1,3 @@
1
+ Before
2
+ <%= yield -%>
3
+ After
@@ -0,0 +1,3 @@
1
+ .partial-layout
2
+ %h2 This is inside a partial layout
3
+ = yield
@@ -0,0 +1,8 @@
1
+ %p
2
+ @foo =
3
+ = @foo
4
+ - @foo = 'value three'
5
+ == Toplevel? #{haml_buffer.toplevel?}
6
+ %p
7
+ @foo =
8
+ = @foo
@@ -0,0 +1,3 @@
1
+ .text_area_test_area
2
+ ~ "<textarea>" + value + "</textarea>"
3
+ = "<textarea>BLAH\n</textarea>"
@@ -0,0 +1,47 @@
1
+ !!!
2
+ %html{html_attrs}
3
+ %head
4
+ %title Hampton Catlin Is Totally Awesome
5
+ %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
6
+ %body
7
+ %h1
8
+ This is very much like the standard template,
9
+ except that it has some ActionView-specific stuff.
10
+ It's only used for benchmarking.
11
+ .crazy_partials= render :partial => 'haml/templates/av_partial_1'
12
+ / You're In my house now!
13
+ .header
14
+ Yes, ladies and gentileman. He is just that egotistical.
15
+ Fantastic! This should be multi-line output
16
+ The question is if this would translate! Ahah!
17
+ = 1 + 9 + 8 + 2 #numbers should work and this should be ignored
18
+ #body= " Quotes should be loved! Just like people!"
19
+ - 120.times do |number|
20
+ - number
21
+ Wow.|
22
+ %p
23
+ = "Holy cow " + |
24
+ "multiline " + |
25
+ "tags! " + |
26
+ "A pipe (|) even!" |
27
+ = [1, 2, 3].collect { |n| "PipesIgnored|" }
28
+ = [1, 2, 3].collect { |n| |
29
+ n.to_s |
30
+ }.join("|") |
31
+ %div.silent
32
+ - foo = String.new
33
+ - foo << "this"
34
+ - foo << " shouldn't"
35
+ - foo << " evaluate"
36
+ = foo + " but now it should!"
37
+ -# Woah crap a comment!
38
+
39
+ -# That was a line that shouldn't close everything.
40
+ %ul.really.cool
41
+ - ('a'..'f').each do |a|
42
+ %li= a
43
+ #combo.of_divs_with_underscore= @should_eval = "with this text"
44
+ = [ 104, 101, 108, 108, 111 ].map do |byte|
45
+ - byte.chr
46
+ .footer
47
+ %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,47 @@
1
+ !!!
2
+ %html{html_attrs}
3
+ %head
4
+ %title Hampton Catlin Is Totally Awesome
5
+ %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
6
+ %body
7
+ %h1
8
+ This is very much like the standard template,
9
+ except that it has some ActionView-specific stuff.
10
+ It's only used for benchmarking.
11
+ .crazy_partials= render :partial => 'haml/templates/av_partial_1_ugly'
12
+ / You're In my house now!
13
+ .header
14
+ Yes, ladies and gentileman. He is just that egotistical.
15
+ Fantastic! This should be multi-line output
16
+ The question is if this would translate! Ahah!
17
+ = 1 + 9 + 8 + 2 #numbers should work and this should be ignored
18
+ #body= " Quotes should be loved! Just like people!"
19
+ - 120.times do |number|
20
+ - number
21
+ Wow.|
22
+ %p
23
+ = "Holy cow " + |
24
+ "multiline " + |
25
+ "tags! " + |
26
+ "A pipe (|) even!" |
27
+ = [1, 2, 3].collect { |n| "PipesIgnored|" }
28
+ = [1, 2, 3].collect { |n| |
29
+ n.to_s |
30
+ }.join("|") |
31
+ %div.silent
32
+ - foo = String.new
33
+ - foo << "this"
34
+ - foo << " shouldn't"
35
+ - foo << " evaluate"
36
+ = foo + " but now it should!"
37
+ -# Woah crap a comment!
38
+
39
+ -# That was a line that shouldn't close everything.
40
+ %ul.really.cool
41
+ - ('a'..'f').each do |a|
42
+ %li= a
43
+ #combo.of_divs_with_underscore= @should_eval = "with this text"
44
+ = [ 104, 101, 108, 108, 111 ].map do |byte|
45
+ - byte.chr
46
+ .footer
47
+ %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,8 @@
1
+ %p
2
+ %h1 Hello!
3
+ = "lots of lines"
4
+ - raise "Oh no!"
5
+ %p
6
+ this is after the exception
7
+ %strong yes it is!
8
+ ho ho ho.
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %body
5
+ #content
6
+ = @content_for_layout
7
+ #yieldy
8
+ = yield :layout
9
+ #nosym
10
+ = yield
@@ -0,0 +1,11 @@
1
+ = "not me!"
2
+ = "nor me!"
3
+ - haml_concat "not even me!"
4
+ %p= "NO!"
5
+ %p~ "UH-UH!"
6
+ %h1 Me!
7
+ #foo
8
+ %p#bar All
9
+ %br/
10
+ %p.baz This
11
+ Should render
@@ -0,0 +1,66 @@
1
+ %style
2
+ - width = 5 + 17
3
+ :sass
4
+ p
5
+ :border
6
+ :style dotted
7
+ :width #{width}px
8
+ :color #ff00ff
9
+ h1
10
+ :font-weight normal
11
+
12
+ :test
13
+ This
14
+ Should
15
+ Not
16
+ Print
17
+
18
+ %p
19
+ :javascript
20
+ function newline(str) {
21
+ return "\n" + str;
22
+ }
23
+
24
+ :plain
25
+ This
26
+ Is
27
+ Plain
28
+ Text
29
+ %strong right?
30
+ \#{not interpolated}
31
+ \\#{1 + 2}
32
+ \\\#{also not}
33
+ \\
34
+
35
+ - last = "noitalo"
36
+ %p
37
+ %pre
38
+ :preserve
39
+ This pre is pretty deeply
40
+ nested.
41
+ Does #{"interp" + last.reverse} work?
42
+ :preserve
43
+ This one is, too.
44
+ Nested, that is.
45
+
46
+ - num = 10
47
+ %ul
48
+ :erb
49
+ <% num.times do |c| %>
50
+ <li><%= (c+97).chr %></li>
51
+ <% end %>
52
+ <% res = 178 %>
53
+
54
+ .res= res
55
+
56
+ = "Text!"
57
+
58
+ - var = "Hello"
59
+ :ruby
60
+ printf "%s, World!\n", var
61
+ print "How are you doing today?\n"
62
+
63
+ :escaped
64
+ <div class="foo">
65
+ <p>I think &mdash; or do I?</p>
66
+ </div>
@@ -0,0 +1,95 @@
1
+ = h("&&&&&&&&&&&") # This is an ActionView Helper... should load
2
+ - foo = capture do # This ActionView Helper is designed for ERB, but should work with haml
3
+ %div
4
+ %p.title Title
5
+ %p.text
6
+ Woah this is really crazy
7
+ I mean wow,
8
+ man.
9
+ - 3.times do
10
+ = foo
11
+ %p foo
12
+ - tab_up
13
+ %p reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong
14
+ - tab_down
15
+ .woah
16
+ #funky
17
+ = capture_haml do
18
+ %div
19
+ %h1 Big!
20
+ %p Small
21
+ / Invisible
22
+ = capture do
23
+ .dilly
24
+ %p foo
25
+ %h1 bar
26
+ = surround '(', ')' do
27
+ %strong parentheses!
28
+ = precede '*' do
29
+ %span.small Not really
30
+ click
31
+ = succeed '.' do
32
+ %a{:href=>"thing"} here
33
+ %p baz
34
+ - haml_buffer.tabulation = 10
35
+ %p boom
36
+ - concat "foo\n"
37
+ - haml_buffer.tabulation = 0
38
+ -#
39
+ -# ActionPack pre-2.0 has weird url_for issues here.
40
+ - if ActionPack::VERSION::MAJOR < 2
41
+ :plain
42
+ <p>
43
+ <form action="" method="post">
44
+ </p>
45
+ <div>
46
+ <form action="" method="post">
47
+ <div><input name="commit" type="submit" value="save" /></div>
48
+ <p>
49
+ @foo =
50
+ value one
51
+ </p>
52
+ Toplevel? false
53
+ <p>
54
+ @foo =
55
+ value three
56
+ </p>
57
+ </form>
58
+ <form action="" method="post">
59
+ Title:
60
+ <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
61
+ Body:
62
+ <input id="article_body" name="article[body]" size="30" type="text" value="World" />
63
+ </form>
64
+ </div>
65
+ - else
66
+ %p
67
+ = form_tag ''
68
+ %div
69
+ - form_tag '' do
70
+ %div= submit_tag 'save'
71
+ - @foo = 'value one'
72
+ = test_partial 'partial'
73
+ - form_for :article, @article, :url => '' do |f|
74
+ Title:
75
+ = f.text_field :title
76
+ Body:
77
+ = f.text_field :body
78
+ = list_of({:google => 'http://www.google.com'}) do |name, link|
79
+ %a{ :href => link }= name
80
+ %p
81
+ - haml_concat "foo"
82
+ %div
83
+ - haml_concat "bar"
84
+ - haml_concat "boom"
85
+ baz
86
+ - haml_concat "boom, again"
87
+ - haml_tag :table do
88
+ - haml_tag :tr do
89
+ - haml_tag :td, {:class => 'cell'} do
90
+ - haml_tag :strong, "strong!"
91
+ - haml_concat "data"
92
+ - haml_tag :td do
93
+ - haml_concat "more_data"
94
+ - haml_tag :hr
95
+ - haml_tag :div, ''
@@ -0,0 +1,11 @@
1
+ %div[@article]
2
+ %h1= @article.title
3
+ %div= @article.body
4
+ #id[@article] id
5
+ .class[@article] class
6
+ #id.class[@article] id class
7
+ %div{:class => "article full"}[@article]= "boo"
8
+ %div{'class' => "article full"}[@article]= "moo"
9
+ %div.articleFull[@article]= "foo"
10
+ %span[@not_a_real_variable_and_will_be_nil]
11
+ Boo