You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.8 KiB
46 lines
1.8 KiB
--- lib/haml/helpers/action_view_mods.rb.orig 2011-07-12 14:20:20.000000000 -0400
|
|
+++ lib/haml/helpers/action_view_mods.rb 2011-07-12 14:21:14.000000000 -0400
|
|
@@ -51,10 +51,7 @@ module ActionView
|
|
# We've got to do the same thing for compatibility.
|
|
|
|
if is_haml? && block_is_haml?(block)
|
|
- value = nil
|
|
- buffer = capture_haml(*args) { value = yield(*args) }
|
|
- return buffer unless buffer.empty?
|
|
- return value if value.is_a?(String)
|
|
+ capture_haml(*args, &block)
|
|
else
|
|
capture_without_haml(*args, &block)
|
|
end
|
|
@@ -88,16 +85,7 @@ module ActionView
|
|
module CaptureHelper
|
|
def capture_with_haml(*args, &block)
|
|
if Haml::Helpers.block_is_haml?(block)
|
|
- value = nil
|
|
- buffer = capture_haml(*args) { value = yield(*args) }
|
|
- str =
|
|
- if !buffer.empty?
|
|
- buffer
|
|
- elsif value.is_a?(String)
|
|
- value
|
|
- else
|
|
- ''
|
|
- end
|
|
+ str = capture_haml(*args, &block)
|
|
return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString)
|
|
return str
|
|
else
|
|
--- test/haml/helper_test.rb.orig 2011-07-12 14:21:25.000000000 -0400
|
|
+++ test/haml/helper_test.rb 2011-07-12 14:21:31.000000000 -0400
|
|
@@ -357,10 +357,6 @@ HAML
|
|
assert_equal("1\n\n2\n\n3\n\n", render("- trc([1, 2, 3]) do |i|\n = i.inspect"))
|
|
end
|
|
|
|
- def test_capture_with_string_block
|
|
- assert_equal("foo\n", render("= capture { 'foo' }", :action_view))
|
|
- end
|
|
-
|
|
def test_find_and_preserve_with_block
|
|
assert_equal("<pre>Foo
Bar</pre>\nFoo\nBar\n",
|
|
render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|