don't pass tabulation to Buffer output calls, fixed calculations of @real_tabs so we can rely

on them and not pass redundant tabbing into to every call


git-svn-id: svn://hamptoncatlin.com/haml/trunk@561 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
tom 2007-07-13 21:58:25 +00:00
parent fb38e27564
commit 5eafacd67c
2 changed files with 11 additions and 7 deletions

View File

@ -55,7 +55,9 @@ module Haml
# Properly formats the output of a script that was run in the
# instance_eval.
def push_script(result, tabulation, flattened, close_tag = nil)
def push_script(result, flattened, close_tag = nil)
tabulation = @real_tabs
if flattened
result = Haml::Helpers.find_and_preserve(result)
end
@ -74,7 +76,7 @@ module Haml
else
if @one_liner_pending
@buffer << "\n"
tabulation += 1
#tabulation += 1
end
result = result.gsub(/^/m, tabs(tabulation))
@ -83,6 +85,7 @@ module Haml
if @one_liner_pending
@one_liner_pending = false
@buffer << "#{tabs(tabulation-1)}</#{close_tag}>\n"
@real_tabs -= 1
end
end
end
@ -91,7 +94,9 @@ module Haml
# Takes the various information about the opening tag for an
# element, formats it, and adds it to the buffer.
def open_tag(name, tabulation, atomic, try_one_line, class_id, obj_ref, content, attributes_hash)
def open_tag(name, atomic, try_one_line, class_id, obj_ref, content, attributes_hash)
tabulation = @real_tabs
attributes = class_id
if attributes_hash
attributes_hash.keys.each { |key| attributes_hash[key.to_s] = attributes_hash.delete(key) }

View File

@ -531,7 +531,7 @@ END
unless options[:suppress_eval]
push_silent("haml_temp = #{text}", true)
out = "haml_temp = _hamlout.push_script(haml_temp, #{@output_tabs}, #{flattened}, #{close_tag.inspect})\n"
out = "haml_temp = _hamlout.push_script(haml_temp, #{flattened}, #{close_tag.inspect})\n"
if @block_opened
push_and_tabulate([:loud, out])
else
@ -789,13 +789,12 @@ END
end
open_tag += "\n" unless parse
push_merged_text(open_tag, tag_closed ? 0 : 1, parse)
#push_silent "_hamlout.open_prerendered_tag(#{open_tag.dump}, #{@output_tabs}, #{parse.inspect}, #{tag_closed.inspect})"
push_merged_text(open_tag, tag_closed || atomic ? 0 : 1, parse)
return if tag_closed
else
flush_merged_text
content = !value_exists || parse ? 'nil' : value.dump
push_silent "_hamlout.open_tag(#{tag_name.inspect}, #{@output_tabs}, #{atomic.inspect}, #{value_exists.inspect}, #{attributes.inspect}, #{object_ref}, #{content}, #{attributes_hash[1...-1]})", true
push_silent "_hamlout.open_tag(#{tag_name.inspect}, #{atomic.inspect}, #{value_exists.inspect}, #{attributes.inspect}, #{object_ref}, #{content}, #{attributes_hash[1...-1]})", true
end
unless atomic