Method: Tiny::Markup#html_tag
- Defined in:
- lib/tiny.rb
#html_tag(name, attrs_or_content = {}, attrs = nil) { ... } ⇒ String
Generates an HTML tag or structured HTML markup
This method is the basis for defining html helper functions or constructing html markup using pure ruby.
HTML attributes are HTML-escaped and tags are explicitly or self closed depeding on the tag name.
Calls to markup generating methods within the content block are appended to the tag’s content. See Tiny::Markup and HTML.
Content blocks originating from HAML or ERB templates are correctly captured and handled.
111 112 113 |
# File 'lib/tiny.rb', line 111 def html_tag name, attrs_or_content = {}, attrs = nil, &block append! Tag.new(name, attrs_or_content, attrs).render(&block) end |