Sha256: 1390da79ea2b21fceaebccad94700be0e7fc88c2dcb4b630e93289d664f86ead
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
module Arbre module Html # This file creates a class for all known HTML 5 tags. You can derive # from these classes to build specialized versions. SELF_CLOSING_TAGS = %w[ input img col br meta link ] OTHER_TAGS = %w[ a abbr address area article aside audio b base bdo blockquote body button canvas caption cite code colgroup command datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe ins keygen kbd label legend li main map mark menu meter nav noscript object ol optgroup option output pre progress q s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr ul var video ] def self.create_tag_class(tag, builder_method = tag.to_sym, self_closing: false) self_closing_method = self_closing ? 'def self_closing_tag?() true end' : '' module_eval <<-RUBY, __FILE__, __LINE__+1 class #{tag.camelize} < Tag builder_method #{builder_method.inspect} tag #{tag.inspect} #{self_closing_method} end RUBY end SELF_CLOSING_TAGS.each do |tag| create_tag_class tag, self_closing: true end OTHER_TAGS.each do |tag| create_tag_class tag end create_tag_class 'p', :para Input.class_eval do attribute :type end Table.class_eval do def initialize(*) super set_table_tag_defaults end protected # Set some good defaults for tables def set_table_tag_defaults set_attribute :border, 0 set_attribute :cellspacing, 0 set_attribute :cellpadding, 0 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arbre2-2.2.4 | lib/arbre/html/html_tags.rb |
arbre2-2.2.3 | lib/arbre/html/html_tags.rb |