module ActionView::Helpers::TagHelper
def tag(name, options = nil, open = false, escape = true)
tag("div", :data => {:name => 'Stephen', :city_state => %w(Chicago IL)})
# =>

tag("img", {:src => "open & shut.png"}, false, false)
# =>

tag("img", :src => "open & shut.png")
# =>
tag("input", :type => 'text', :disabled => true)
# =>
tag("br", nil, true)
# =>
tag("br")
==== Examples
from 1.4.3.
This may come in handy when using jQuery's HTML5-aware .data()
Values are encoded to JSON, with the exception of strings and symbols.
thus accessed as dataset.userId.
For example, a key +user_id+ would render as data-user-id and
To play nicely with JavaScript conventions sub-attributes are dasherized.
pointing to a hash of sub-attributes.
HTML5 data-* attributes can be set with a single +data+ key
+disabled+ and +readonly+.
Use +true+ with boolean attributes that can render with no value, like
You can use symbols or strings for the attribute names.
==== Options
escaping.
hash to +options+. Set +escape+ to false to disable attribute value
with HTML 4.0 and below. Add HTML attributes by passing an attributes
compliant. Set +open+ to true to create an open tag compatible
Returns an empty HTML tag of type +name+ which by default is XHTML
def tag(name, options = nil, open = false, escape = true) "<#{name}#{tag_options(options, escape) if options}#{open ? ">" : " />"}".html_safe end