mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Make our modified #capture compatible with an oddity of Rails's.
This commit is contained in:
parent
161140580f
commit
7fcd7b739f
1 changed files with 13 additions and 1 deletions
|
@ -15,7 +15,19 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
|
|||
# :stopdoc:
|
||||
module CaptureHelper
|
||||
def capture_with_haml(*args, &block)
|
||||
if is_haml?
|
||||
# Rails' #capture helper will just return the value of the block
|
||||
# if it's not actually in the template context,
|
||||
# as detected by the existance of an _erbout variable.
|
||||
# We've got to do the same thing for compatibility.
|
||||
block_is_haml =
|
||||
begin
|
||||
eval('_hamlout', block)
|
||||
true
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
if block_is_haml && is_haml?
|
||||
capture_haml(*args, &block)
|
||||
else
|
||||
capture_without_haml(*args, &block)
|
||||
|
|
Loading…
Add table
Reference in a new issue