def process_call exp
target = exp.target
if sexp? target
target = process target
end
method = exp.method
if (call? target and target.method == :_hamlout)
res = case method
when :adjust_tabs, :rstrip!, :attributes
ignore
when :options, :buffer
exp
when :open_tag
process_call_args exp
else
arg = exp.first_arg
if arg
@inside_concat = true
exp.first_arg = process(arg)
out = normalize_output(exp.first_arg)
@inside_concat = false
else
raise "Empty _hamlout.#{method}()?"
end
if string? out
ignore
else
r = case method.to_s
when "push_text"
build_output_from_push_text(out)
when HAML_FORMAT_METHOD
if $4 == "true"
if string_interp? out
build_output_from_push_text(out, :escaped_output)
else
Sexp.new :format_escaped, out
end
else
if string_interp? out
build_output_from_push_text(out)
else
Sexp.new :format, out
end
end
else
raise "Unrecognized action on _hamlout: #{method}"
end
@javascript = false
r
end
end
res.line(exp.line)
res
elsif sexp? target and method == :<< and is_buffer_target? target
@inside_concat = true
exp.first_arg = process(exp.first_arg)
out = normalize_output(exp.first_arg)
@inside_concat = false
if out.node_type == :str
ignore
else
add_output out
end
elsif target == nil and method == :render
exp.arglist = process exp.arglist
make_render_in_view exp
elsif target == nil and method == :find_and_preserve and exp.first_arg
process exp.first_arg
elsif method == :render_with_options
if target == JAVASCRIPT_FILTER or target == COFFEE_FILTER
@javascript = true
end
process exp.first_arg
else
exp.target = target
exp.arglist = process exp.arglist
exp
end
end