Sha256: be1a7a6fd9e3fa5533ce03793f89e2ee20e6d1d3600fd388a4a7d818cdbb49de

Contents?: true

Size: 1.6 KB

Versions: 28

Compression:

Stored size: 1.6 KB

Contents

module Arbre
  module HTML

    AUTO_BUILD_ELEMENTS = [ :a, :abbr, :address, :area, :article, :aside, :audio, :b, :base,
                       :bdo, :blockquote, :body, :br, :button, :canvas, :caption, :cite,
                       :code, :col, :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, :img, :input, :ins, :keygen, :kbd, :label, 
                       :legend, :li, :link, :map, :mark, :menu, :meta, :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 ]

    HTML5_ELEMENTS = [ :p ] + AUTO_BUILD_ELEMENTS

    AUTO_BUILD_ELEMENTS.each do |name|
      class_eval <<-EOF
        class #{name.to_s.capitalize} < Tag
          builder_method :#{name}
        end
      EOF
    end

    class P < Tag
      builder_method :para
    end

    class Table < Tag
      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

28 entries across 28 versions & 5 rubygems

Version Path
arbre-1.0.2 lib/arbre/html/html5_elements.rb
arbre-1.0.1 lib/arbre/html/html5_elements.rb
arbre-1.0.0 lib/arbre/html/html5_elements.rb
arbre-1.0.0.rc4 lib/arbre/html/html5_elements.rb
arbre-1.0.0.rc3 lib/arbre/html/html5_elements.rb
arbre-1.0.0.rc2 lib/arbre/html/html5_elements.rb
arbre-1.0.0.rc1 lib/arbre/html/html5_elements.rb
activeadmin-0.4.4 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.4.3 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.4.2 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.4.1 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.4.0 lib/active_admin/arbre/html/html5_elements.rb
andrewroth_activeadmin-0.3.4.4 lib/active_admin/arbre/html/html5_elements.rb
andrewroth_activeadmin-0.3.4.3 lib/active_admin/arbre/html/html5_elements.rb
andrewroth_activeadmin-0.3.4.2 lib/active_admin/arbre/html/html5_elements.rb
andrewroth_activeadmin-0.3.4.1 lib/active_admin/arbre/html/html5_elements.rb
andrewroth_activeadmin-0.3.4 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.3.4 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.3.3 lib/active_admin/arbre/html/html5_elements.rb
activeadmin-0.3.2 lib/active_admin/arbre/html/html5_elements.rb