Module: HtmlRB
- Defined in:
- lib/html_rb.rb,
lib/html_rb.rb,
lib/html_rb/tag.rb,
lib/html_rb/constants.rb
Defined Under Namespace
Classes: Tag
Constant Summary collapse
- VERSION =
"2.0.0".freeze
- Error =
Class.new(StandardError)
- STD_ELEMENTS =
[ :a, :abbr, :address, :article, :aside, :audio, :b, :bdi, :bdo, :blockquote, :body, :button, :canvas, :caption, :cite, :code, :colgroup, :datalist, :dd, :del, :details, :dfn, :dialog, :div, :dl, :dt, :em, :fieldset, :figcaption, :figure, :footer, :form, :h1, :head, :header, :html, :i, :iframe, :ins, :kbd, :label, :legend, :li, :main, :map, :mark, :menu, :menuitem, :meter, :nav, :noscript, :object, :ol, :optgroup, :option, :output, :p, :pre, :progress, :q, :rp, :rt, :ruby, :s, :samp, :script, :section, :select, :small, :span, :strong, :style, :sub, :summary, :sup, :table, :tbody, :td, :textarea, :tfoot, :th, :thead, :time, :title, :tr, :u, :ul, :var, :video, ].to_set.freeze
- VOID_ELEMENTS =
[ :area, :base, :br, :col, :embed, :hr, :img, :input, :keygen, :link, :meta, :param, :source, :track, :wbr, ].to_set.freeze
- BOOL_ATTRS =
[ :allowfullscreen, :async, :autofocus, :autoplay, :checked, :compact, :controls, :declare, :default, :defaultchecked, :defaultmuted, :defaultselected, :defer, :disabled, :draggable, :enabled, :formnovalidate, :hidden, :indeterminate, :inert, :ismap, :itemscope, :loop, :multiple, :muted, :nohref, :noresize, :noshade, :novalidate, :nowrap, :open, :pauseonexit, :readonly, :required, :reversed, :scoped, :seamless, :selected, :sortable, :spellcheck, :translate, :truespeed, :typemustmatch, :visible, ].to_set.freeze
Class Method Summary collapse
Class Method Details
.html(content = nil, document: false, **attrs, &block) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/html_rb.rb', line 10 module_function def html(content=nil, document: false, **attrs, &block) if document "<!DOCTYPE html>" + Tag.new('html', content, **attrs, &block).to_s else Tag.new(nil, content, **attrs, &block).to_s end end |