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

Fix form_tag indentation.

This commit is contained in:
Nathan Weizenbaum 2008-12-22 15:26:58 -08:00
parent 6b3dd3cf2a
commit a8fa047e71
2 changed files with 12 additions and 3 deletions

View file

@ -264,7 +264,7 @@ module Haml
min_tabs = nil
captured.each do |line|
tabs = line.index(/[^ ]/)
tabs = line.index(/[^ ]/) || line.length
min_tabs ||= tabs
min_tabs = min_tabs > tabs ? tabs : min_tabs
end
@ -287,10 +287,15 @@ END
# Outputs text directly to the Haml buffer, with the proper tabulation
def haml_concat(text = "")
haml_buffer.buffer << (' ' * haml_buffer.tabulation) << text.to_s << "\n"
haml_buffer.buffer << haml_indent << text.to_s << "\n"
nil
end
# Returns the string that should be used to indent the current line
def haml_indent
' ' * haml_buffer.tabulation
end
#
# call-seq:
# haml_tag(name, *flags, attributes = {}) {...}

View file

@ -141,10 +141,12 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
tab_up
oldproc.call(*args)
tab_down
concat haml_indent
end
concat haml_indent
end
res = form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) + "\n"
concat "\n" if block_given? && is_haml?
concat "\n" if block_given?
res
else
form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc)
@ -162,7 +164,9 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
tab_up
oldproc.call(*args)
tab_down
concat haml_indent
end
concat haml_indent
end
form_for_without_haml(object_name, *args, &proc)
concat "\n" if block_given? && is_haml?