module Padrino::Helpers::TagHelpers
def tag(name, options={})
- Api: - public
Returns:
-
(String)
- The html for the input tag.
Parameters:
-
options
(Hash
) -- -
type
(Symbol
) --
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.map { |a, v| v.nil? || v == false ? nil : "#{a}=\"#{escape_value(v)}\"" }.compact.join(" ") base_tag = (html_attrs.present? ? "<#{name} #{html_attrs}" : "<#{name}") base_tag << (open_tag ? ">" : (content ? ">#{content}</#{name}>" : " />")) end