# File lib/haml/helpers/action_view_mods.rb, line 47
        def capture_with_haml(*args, &block)
          # 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.

          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)
          else
            capture_without_haml(*args, &block)
          end
        end