module Padrino::Helpers::TagHelpers
def tag(name, options={})
tag(:p, :content => "hello", :class => 'large')
tag(:br, :style => 'clear:both')
==== Examples
Creates an html tag with the given name and options
#
def tag(name, options={}) content, open_tag = options.delete(:content), options.delete(:open) content = content.join("\n") if content.respond_to?(:join) identity_tag_attributes.each { |attr| options[attr] = attr.to_s if options[attr] } html_attrs = options.collect { |a, v| v.blank? ? nil : "#{a}=\"#{v}\"" }.compact.join(" ") base_tag = (html_attrs.present? ? "<#{name} #{html_attrs}" : "<#{name}") base_tag << (open_tag ? ">" : (content ? ">#{content}</#{name}>" : " />")) end