drnic-haml 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. data/.yardopts +5 -0
  2. data/CONTRIBUTING +4 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +347 -0
  5. data/REVISION +1 -0
  6. data/Rakefile +371 -0
  7. data/VERSION +1 -0
  8. data/VERSION_NAME +1 -0
  9. data/bin/css2sass +7 -0
  10. data/bin/haml +9 -0
  11. data/bin/html2haml +7 -0
  12. data/bin/sass +8 -0
  13. data/extra/haml-mode.el +663 -0
  14. data/extra/sass-mode.el +205 -0
  15. data/extra/update_watch.rb +13 -0
  16. data/init.rb +8 -0
  17. data/lib/haml.rb +40 -0
  18. data/lib/haml/buffer.rb +307 -0
  19. data/lib/haml/engine.rb +301 -0
  20. data/lib/haml/error.rb +22 -0
  21. data/lib/haml/exec.rb +470 -0
  22. data/lib/haml/filters.rb +341 -0
  23. data/lib/haml/helpers.rb +560 -0
  24. data/lib/haml/helpers/action_view_extensions.rb +40 -0
  25. data/lib/haml/helpers/action_view_mods.rb +176 -0
  26. data/lib/haml/herb.rb +96 -0
  27. data/lib/haml/html.rb +308 -0
  28. data/lib/haml/precompiler.rb +997 -0
  29. data/lib/haml/shared.rb +78 -0
  30. data/lib/haml/template.rb +51 -0
  31. data/lib/haml/template/patch.rb +58 -0
  32. data/lib/haml/template/plugin.rb +71 -0
  33. data/lib/haml/util.rb +244 -0
  34. data/lib/haml/version.rb +64 -0
  35. data/lib/sass.rb +24 -0
  36. data/lib/sass/css.rb +423 -0
  37. data/lib/sass/engine.rb +491 -0
  38. data/lib/sass/environment.rb +79 -0
  39. data/lib/sass/error.rb +162 -0
  40. data/lib/sass/files.rb +133 -0
  41. data/lib/sass/plugin.rb +170 -0
  42. data/lib/sass/plugin/merb.rb +57 -0
  43. data/lib/sass/plugin/rails.rb +23 -0
  44. data/lib/sass/repl.rb +58 -0
  45. data/lib/sass/script.rb +55 -0
  46. data/lib/sass/script/bool.rb +17 -0
  47. data/lib/sass/script/color.rb +183 -0
  48. data/lib/sass/script/funcall.rb +50 -0
  49. data/lib/sass/script/functions.rb +199 -0
  50. data/lib/sass/script/lexer.rb +191 -0
  51. data/lib/sass/script/literal.rb +177 -0
  52. data/lib/sass/script/node.rb +14 -0
  53. data/lib/sass/script/number.rb +381 -0
  54. data/lib/sass/script/operation.rb +45 -0
  55. data/lib/sass/script/parser.rb +222 -0
  56. data/lib/sass/script/string.rb +12 -0
  57. data/lib/sass/script/unary_operation.rb +34 -0
  58. data/lib/sass/script/variable.rb +31 -0
  59. data/lib/sass/tree/comment_node.rb +84 -0
  60. data/lib/sass/tree/debug_node.rb +30 -0
  61. data/lib/sass/tree/directive_node.rb +70 -0
  62. data/lib/sass/tree/for_node.rb +48 -0
  63. data/lib/sass/tree/if_node.rb +54 -0
  64. data/lib/sass/tree/import_node.rb +69 -0
  65. data/lib/sass/tree/mixin_def_node.rb +29 -0
  66. data/lib/sass/tree/mixin_node.rb +48 -0
  67. data/lib/sass/tree/node.rb +252 -0
  68. data/lib/sass/tree/prop_node.rb +106 -0
  69. data/lib/sass/tree/root_node.rb +56 -0
  70. data/lib/sass/tree/rule_node.rb +220 -0
  71. data/lib/sass/tree/variable_node.rb +34 -0
  72. data/lib/sass/tree/while_node.rb +31 -0
  73. data/rails/init.rb +1 -0
  74. data/test/benchmark.rb +99 -0
  75. data/test/haml/engine_test.rb +1129 -0
  76. data/test/haml/helper_test.rb +282 -0
  77. data/test/haml/html2haml_test.rb +258 -0
  78. data/test/haml/markaby/standard.mab +52 -0
  79. data/test/haml/mocks/article.rb +6 -0
  80. data/test/haml/results/content_for_layout.xhtml +12 -0
  81. data/test/haml/results/eval_suppressed.xhtml +9 -0
  82. data/test/haml/results/filters.xhtml +62 -0
  83. data/test/haml/results/helpers.xhtml +93 -0
  84. data/test/haml/results/helpful.xhtml +10 -0
  85. data/test/haml/results/just_stuff.xhtml +68 -0
  86. data/test/haml/results/list.xhtml +12 -0
  87. data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  88. data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  89. data/test/haml/results/original_engine.xhtml +20 -0
  90. data/test/haml/results/partial_layout.xhtml +5 -0
  91. data/test/haml/results/partials.xhtml +21 -0
  92. data/test/haml/results/render_layout.xhtml +3 -0
  93. data/test/haml/results/silent_script.xhtml +74 -0
  94. data/test/haml/results/standard.xhtml +162 -0
  95. data/test/haml/results/tag_parsing.xhtml +23 -0
  96. data/test/haml/results/very_basic.xhtml +5 -0
  97. data/test/haml/results/whitespace_handling.xhtml +89 -0
  98. data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
  99. data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
  100. data/test/haml/rhtml/action_view.rhtml +62 -0
  101. data/test/haml/rhtml/standard.rhtml +54 -0
  102. data/test/haml/spec_test.rb +44 -0
  103. data/test/haml/template_test.rb +217 -0
  104. data/test/haml/templates/_av_partial_1.haml +9 -0
  105. data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
  106. data/test/haml/templates/_av_partial_2.haml +5 -0
  107. data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
  108. data/test/haml/templates/_layout.erb +3 -0
  109. data/test/haml/templates/_layout_for_partial.haml +3 -0
  110. data/test/haml/templates/_partial.haml +8 -0
  111. data/test/haml/templates/_text_area.haml +3 -0
  112. data/test/haml/templates/action_view.haml +47 -0
  113. data/test/haml/templates/action_view_ugly.haml +47 -0
  114. data/test/haml/templates/breakage.haml +8 -0
  115. data/test/haml/templates/content_for_layout.haml +8 -0
  116. data/test/haml/templates/eval_suppressed.haml +11 -0
  117. data/test/haml/templates/filters.haml +66 -0
  118. data/test/haml/templates/helpers.haml +95 -0
  119. data/test/haml/templates/helpful.haml +11 -0
  120. data/test/haml/templates/just_stuff.haml +83 -0
  121. data/test/haml/templates/list.haml +12 -0
  122. data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  123. data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  124. data/test/haml/templates/original_engine.haml +17 -0
  125. data/test/haml/templates/partial_layout.haml +3 -0
  126. data/test/haml/templates/partialize.haml +1 -0
  127. data/test/haml/templates/partials.haml +12 -0
  128. data/test/haml/templates/render_layout.haml +2 -0
  129. data/test/haml/templates/silent_script.haml +40 -0
  130. data/test/haml/templates/standard.haml +42 -0
  131. data/test/haml/templates/standard_ugly.haml +42 -0
  132. data/test/haml/templates/tag_parsing.haml +21 -0
  133. data/test/haml/templates/very_basic.haml +4 -0
  134. data/test/haml/templates/whitespace_handling.haml +87 -0
  135. data/test/haml/util_test.rb +92 -0
  136. data/test/linked_rails.rb +12 -0
  137. data/test/sass/css2sass_test.rb +294 -0
  138. data/test/sass/engine_test.rb +956 -0
  139. data/test/sass/functions_test.rb +126 -0
  140. data/test/sass/more_results/more1.css +9 -0
  141. data/test/sass/more_results/more1_with_line_comments.css +26 -0
  142. data/test/sass/more_results/more_import.css +29 -0
  143. data/test/sass/more_templates/_more_partial.sass +2 -0
  144. data/test/sass/more_templates/more1.sass +23 -0
  145. data/test/sass/more_templates/more_import.sass +11 -0
  146. data/test/sass/plugin_test.rb +229 -0
  147. data/test/sass/results/alt.css +4 -0
  148. data/test/sass/results/basic.css +9 -0
  149. data/test/sass/results/compact.css +5 -0
  150. data/test/sass/results/complex.css +87 -0
  151. data/test/sass/results/compressed.css +1 -0
  152. data/test/sass/results/expanded.css +19 -0
  153. data/test/sass/results/import.css +29 -0
  154. data/test/sass/results/line_numbers.css +49 -0
  155. data/test/sass/results/mixins.css +95 -0
  156. data/test/sass/results/multiline.css +24 -0
  157. data/test/sass/results/nested.css +22 -0
  158. data/test/sass/results/parent_ref.css +13 -0
  159. data/test/sass/results/script.css +16 -0
  160. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  161. data/test/sass/results/subdir/subdir.css +3 -0
  162. data/test/sass/results/units.css +11 -0
  163. data/test/sass/script_test.rb +261 -0
  164. data/test/sass/templates/_partial.sass +2 -0
  165. data/test/sass/templates/alt.sass +16 -0
  166. data/test/sass/templates/basic.sass +23 -0
  167. data/test/sass/templates/bork1.sass +2 -0
  168. data/test/sass/templates/bork2.sass +2 -0
  169. data/test/sass/templates/bork3.sass +2 -0
  170. data/test/sass/templates/compact.sass +17 -0
  171. data/test/sass/templates/complex.sass +307 -0
  172. data/test/sass/templates/compressed.sass +15 -0
  173. data/test/sass/templates/expanded.sass +17 -0
  174. data/test/sass/templates/import.sass +11 -0
  175. data/test/sass/templates/importee.sass +19 -0
  176. data/test/sass/templates/line_numbers.sass +13 -0
  177. data/test/sass/templates/mixins.sass +76 -0
  178. data/test/sass/templates/multiline.sass +20 -0
  179. data/test/sass/templates/nested.sass +25 -0
  180. data/test/sass/templates/nested_bork1.sass +2 -0
  181. data/test/sass/templates/nested_bork2.sass +2 -0
  182. data/test/sass/templates/nested_bork3.sass +2 -0
  183. data/test/sass/templates/parent_ref.sass +25 -0
  184. data/test/sass/templates/script.sass +101 -0
  185. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  186. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  187. data/test/sass/templates/subdir/subdir.sass +6 -0
  188. data/test/sass/templates/units.sass +11 -0
  189. data/test/test_helper.rb +44 -0
  190. metadata +298 -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,44 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+
4
+ begin
5
+ require 'json'
6
+ rescue LoadError
7
+ end
8
+
9
+ class SpecTest < Test::Unit::TestCase
10
+ spec_file = File.dirname(__FILE__) + '/spec/tests.json'
11
+ if !File.exists?(spec_file)
12
+ error = <<MSG.rstrip
13
+ Couldn't load haml-spec, skipping some tests.
14
+ To use haml-spec, run `git submodule update --init`
15
+ MSG
16
+ elsif !defined?(JSON)
17
+ error = "Couldn't load json, skipping some tests."
18
+ end
19
+
20
+ if error
21
+ define_method(:test_fake_couldnt_load_spec) {warn("\n" + error)}
22
+ else
23
+ JSON.parse(File.read(spec_file)).each do |name, tests|
24
+ tests.each do |subname, test|
25
+ define_method("test_spec: #{name} (#{subname})") do
26
+ options = convert_hash(test["config"])
27
+ options[:format] = options[:format].to_sym if options[:format]
28
+ engine = Haml::Engine.new(test["haml"], options)
29
+
30
+ result = engine.render(Object.new, convert_hash(test["locals"]))
31
+
32
+ assert_equal(test["html"], result.rstrip)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ def convert_hash(hash)
41
+ return {} unless hash
42
+ Haml::Util.map_keys(hash) {|k| k.to_sym}
43
+ end
44
+ end
@@ -0,0 +1,217 @@
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
+
39
+ def controller_path
40
+ ''
41
+ end
42
+ end
43
+
44
+ class TemplateTest < Test::Unit::TestCase
45
+ TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
46
+ TEMPLATES = %w{ very_basic standard helpers
47
+ whitespace_handling original_engine list helpful
48
+ silent_script tag_parsing just_stuff partials
49
+ filters nuke_outer_whitespace nuke_inner_whitespace
50
+ render_layout }
51
+ # partial layouts were introduced in 2.0.0
52
+ TEMPLATES << 'partial_layout' unless ActionPack::VERSION::MAJOR < 2
53
+
54
+ def setup
55
+ @base = create_base
56
+
57
+ # filters template uses :sass
58
+ Sass::Plugin.options.update(:line_comments => true, :style => :compact)
59
+ end
60
+
61
+ def create_base
62
+ vars = { 'article' => Article.new, 'foo' => 'value one' }
63
+
64
+ unless Haml::Util.has?(:instance_method, ActionView::Base, :finder)
65
+ base = ActionView::Base.new(TEMPLATE_PATH, vars)
66
+ else
67
+ # Rails 2.1.0
68
+ base = ActionView::Base.new([], vars)
69
+ base.finder.append_view_path(TEMPLATE_PATH)
70
+ end
71
+
72
+ if Haml::Util.has?(:private_method, base, :evaluate_assigns)
73
+ base.send(:evaluate_assigns)
74
+ else
75
+ # Rails 2.2
76
+ base.send(:_evaluate_assigns_and_ivars)
77
+ end
78
+
79
+ # This is used by form_for.
80
+ # It's usually provided by ActionController::Base.
81
+ def base.protect_against_forgery?; false; end
82
+
83
+ base.controller = DummyController.new
84
+ base
85
+ end
86
+
87
+ def render(text)
88
+ Haml::Engine.new(text).to_html(@base)
89
+ end
90
+
91
+ def load_result(name)
92
+ @result = ''
93
+ File.new(File.dirname(__FILE__) + "/results/#{name}.xhtml").each_line { |l| @result += l }
94
+ @result
95
+ end
96
+
97
+ def assert_renders_correctly(name, &render_method)
98
+ if ActionPack::VERSION::MAJOR < 2 ||
99
+ (ActionPack::VERSION::MAJOR == 2 && ActionPack::VERSION::MINOR < 2)
100
+ render_method ||= proc { |name| @base.render(name) }
101
+ else
102
+ render_method ||= proc { |name| @base.render(:file => name) }
103
+ end
104
+
105
+ load_result(name).split("\n").zip(render_method[name].split("\n")).each_with_index do |pair, line|
106
+ message = "template: #{name}\nline: #{line}"
107
+ assert_equal(pair.first, pair.last, message)
108
+ end
109
+ rescue ActionView::TemplateError => e
110
+ if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
111
+ puts "\nCouldn't require #{$2}; skipping a test."
112
+ else
113
+ raise e
114
+ end
115
+ end
116
+
117
+ def test_empty_render_should_remain_empty
118
+ assert_equal('', render(''))
119
+ end
120
+
121
+ TEMPLATES.each do |template|
122
+ define_method "test_template_should_render_correctly [template: #{template}] " do
123
+ assert_renders_correctly template
124
+ end
125
+ end
126
+
127
+ def test_templates_should_render_correctly_with_render_proc
128
+ assert_renders_correctly("standard") do |name|
129
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
130
+ engine.render_proc(@base).call
131
+ end
132
+ end
133
+
134
+ def test_templates_should_render_correctly_with_def_method
135
+ assert_renders_correctly("standard") do |name|
136
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
137
+ engine.def_method(@base, "render_standard")
138
+ @base.render_standard
139
+ end
140
+ end
141
+
142
+ def test_action_view_templates_render_correctly
143
+ proc = lambda do
144
+ @base.content_for(:layout) {'Lorem ipsum dolor sit amet'}
145
+ assert_renders_correctly 'content_for_layout'
146
+ end
147
+
148
+ if @base.respond_to?(:with_output_buffer)
149
+ @base.with_output_buffer("", &proc)
150
+ else
151
+ proc.call
152
+ end
153
+ end
154
+
155
+ def test_instance_variables_should_work_inside_templates
156
+ @base.instance_variable_set("@content_for_layout", 'something')
157
+ assert_equal("<p>something</p>", render("%p= @content_for_layout").chomp)
158
+
159
+ @base.instance_eval("@author = 'Hampton Catlin'")
160
+ assert_equal("<div class='author'>Hampton Catlin</div>", render(".author= @author").chomp)
161
+
162
+ @base.instance_eval("@author = 'Hampton'")
163
+ assert_equal("Hampton", render("= @author").chomp)
164
+
165
+ @base.instance_eval("@author = 'Catlin'")
166
+ assert_equal("Catlin", render("= @author").chomp)
167
+ end
168
+
169
+ def test_instance_variables_should_work_inside_attributes
170
+ @base.instance_eval("@author = 'hcatlin'")
171
+ assert_equal("<p class='hcatlin'>foo</p>", render("%p{:class => @author} foo").chomp)
172
+ end
173
+
174
+ def test_template_renders_should_eval
175
+ assert_equal("2\n", render("= 1+1"))
176
+ end
177
+
178
+ def test_haml_options
179
+ Haml::Template.options = { :suppress_eval => true }
180
+ assert_equal({ :suppress_eval => true }, Haml::Template.options)
181
+ old_base, @base = @base, create_base
182
+ assert_renders_correctly("eval_suppressed")
183
+ @base = old_base
184
+ Haml::Template.options = {}
185
+ end
186
+
187
+ def test_exceptions_should_work_correctly
188
+ begin
189
+ render("- raise 'oops!'")
190
+ rescue Exception => e
191
+ assert_equal("oops!", e.message)
192
+ assert_match(/^\(haml\):1/, e.backtrace[0])
193
+ else
194
+ assert false
195
+ end
196
+
197
+ template = <<END
198
+ %p
199
+ %h1 Hello!
200
+ = "lots of lines"
201
+ = "even more!"
202
+ - raise 'oh no!'
203
+ %p
204
+ this is after the exception
205
+ %strong yes it is!
206
+ ho ho ho.
207
+ END
208
+
209
+ begin
210
+ render(template.chomp)
211
+ rescue Exception => e
212
+ assert_match(/^\(haml\):5/, e.backtrace[0])
213
+ else
214
+ assert false
215
+ end
216
+ end
217
+ 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"