Helpers related to producing html tags within templates.
Tag values escaped to html entities.
{ "&" => "&", "<" => "<", ">" => ">", '"' => """ }.freeze
Cached Regexp for escaping values to avoid rebuilding one on every escape operation.
Regexp.union(*ESCAPE_VALUES.keys).freeze
[ :autoplay, :autofocus, :formnovalidate, :checked, :disabled, :hidden, :loop, :multiple, :muted, :readonly, :required, :selected, :declare, :defer, :ismap, :itemscope, :noresize, :novalidate ].freeze
Custom data attributes, feel free to update with yours:
Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog) text_field :foo, :dialog => true # Generates: <input type="text" data-dialog="true" name="foo" />
[ :method, :remote, :confirm ]
A html_safe newline string to avoid allocating a new on each concatenation.
"\n".html_safe.freeze
#content_tag(name, content = nil, options = nil, &block) ⇒ String
Creates an HTML tag with given name, content, and options. #escape_link(link) ⇒ Object
Returns an escaped document link. #input_tag(type, options = {}) ⇒ String
Creates an HTML input field with the given type and options. #safe_content_tag(name, content = nil, options = nil, &block) ⇒ Object
Like #content_tag, but assumes its input to be safe and doesn't escape. #tag(name, options = nil, open = false) ⇒ String
Creates an HTML tag with the given name and options. Creates an HTML tag with given name, content, and options.
Returns an escaped document link.
Creates an HTML input field with the given type and options.
Like #content_tag, but assumes its input to be safe and doesn't escape. It also returns safe HTML.
Creates an HTML tag with the given name and options.
© 2010–2019 Padrino
Licensed under the MIT License.
https://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Helpers/TagHelpers