adding attributes to open_tag

git-svn-id: svn://hamptoncatlin.com/haml/trunk@404 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
hcatlin 2007-03-14 16:00:08 +00:00
parent 97732c5bc4
commit f92025c7fa
1 changed files with 5 additions and 3 deletions

View File

@ -79,8 +79,10 @@ if action_view_included
# end # end
# #
# TODO: Make it output with better tabulation # TODO: Make it output with better tabulation
def open_tag(named, &block) def open_tag(named, options = {}, &block)
push_text "<#{named}>" # TODO: I'm sure re-coding this is bad. I know we do this elsewhere, obviously.
attributes = (options.collect { |key, value| "#{key}='#{value}'" }).join(" ")
push_text "<#{named}#{attributes}>"
tab_up tab_up
block.call block.call
concat "\n" concat "\n"
@ -95,7 +97,7 @@ if action_view_included
tab_up tab_up
oldproc.call(*args) oldproc.call(*args)
tab_down tab_down
end end
end end
old_form_for(object_name, *args, &proc) old_form_for(object_name, *args, &proc)
concat "\n" if block_given? && is_haml? concat "\n" if block_given? && is_haml?