1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Haml] Get rid of a lot of the nasty haml_temp nonsense in the generated Ruby.

This commit is contained in:
Nathan Weizenbaum 2009-10-25 13:48:28 -07:00
parent 46312796e8
commit 5cad2c8310

View file

@ -361,14 +361,14 @@ END
no_format = @options[:ugly] &&
!(opts[:preserve_script] || opts[:preserve_tag] || opts[:escape_html])
output_temp = "(haml_very_temp = haml_temp; haml_temp = nil; haml_very_temp)"
out = "_hamlout.#{static_method_name(:format_script, *args)}(#{output_temp});"
output_expr = "(#{text}\n)"
static_method = "_hamlout.#{static_method_name(:format_script, *args)}"
# Prerender tabulation unless we're in a tag
push_merged_text '' unless opts[:in_tag]
unless block_opened?
@to_merge << [:script, no_format ? "#{text}\n" : "haml_temp = #{text}\n#{out}"]
@to_merge << [:script, no_format ? "#{text}\n" : "#{static_method}(#{output_expr});"]
concat_merged_text("\n") unless opts[:in_tag] || opts[:nuke_inner_whitespace]
@newlines -= 1
return
@ -378,7 +378,7 @@ END
push_silent "haml_temp = #{text}"
newline_now
push_and_tabulate([:loud, "_hamlout.buffer << #{no_format ? "#{output_temp}.to_s;" : out}",
push_and_tabulate([:loud, "_hamlout.buffer << #{no_format ? "haml_temp.to_s;" : "#{static_method}(haml_temp);"}",
!(opts[:in_tag] || opts[:nuke_inner_whitespace] || @options[:ugly])])
end