require 'cgi'
require 'erb'
module ActionView
module Helpers
# This is poor man's Builder for the rare cases where you need to programmatically make tags but can't use Builder.
module TagHelper
include ERB::Util
# Examples:
# * tag("br") =>
# * tag("input", { "type" => "text"}) =>
def tag(name, options = {}, open = false)
"<#{name}#{tag_options(options)}" + (open ? ">" : " />")
end
# Examples:
# * content_tag("p", "Hello world!") =>
Hello world!
# * content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") => #Hello world!