| 3 | | TAGS = [ |
| 4 | | :a, :abbr, :acronym, :span, :b, :caption, :del, :cite, :code, :col, |
| 5 | | :colgroup, :dd, :dfn, :dt, :em, :fieldset, :i, :img, :ins, :kbd, :p, |
| 6 | | :label, :legend, :li, :optgroup, :option, :select, :small, :span, :strong, |
| 7 | | :sub, :sup, :tbody, :td, :textarea, :thead, :title, :th, :tr, :tfoot, |
| 8 | | :tt, :address, :blockquote, :body, :div, :dl, :form, :h1, :h2, :h3, :head, |
| 9 | | :noscript, :object, :ol, :pre, :q, :samp, :script, :style, :table, :ul |
| 10 | | ] |
| | 3 | # Common sets of attributes. |
| | 4 | AttrCustom = [:id, :class, :style] |
| | 5 | AttrEvents = [:onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover, :onmousemove, |
| | 6 | :onmouseout, :onkeypress, :onkeydown, :onkeyup] |
| | 7 | AttrAnno = [:title, :lang, :dir] |
| | 8 | |
| | 9 | # Very basic rules from the XHTML 1.0 Strict DTD. |
| | 10 | XHTMLStrictTags = { |
| | 11 | :pre => AttrCustom + AttrAnno + [:space], |
| | 12 | :em => AttrCustom + AttrAnno + AttrEvents, |
| | 13 | :code => AttrCustom + AttrAnno + AttrEvents, |
| | 14 | :h2 => AttrCustom + AttrAnno + AttrEvents, |
| | 15 | :h3 => AttrCustom + AttrAnno + AttrEvents, |
| | 16 | :h1 => AttrCustom + AttrAnno + AttrEvents, |
| | 17 | :h6 => AttrCustom + AttrAnno + AttrEvents, |
| | 18 | :dl => AttrCustom + AttrAnno + AttrEvents, |
| | 19 | :h4 => AttrCustom + AttrAnno + AttrEvents, |
| | 20 | :h5 => AttrCustom + AttrAnno + AttrEvents, |
| | 21 | :area => AttrCustom + AttrAnno + AttrEvents + [:accesskey, :tabindex, :onfocus, :onblur, :shape, :coords, :href, :nohref, :alt], |
| | 22 | :meta => [:lang, :dir, :id, :'http-equiv', :name, :content, :scheme], |
| | 23 | :table => [], |
| | 24 | :dfn => AttrCustom + AttrAnno + AttrEvents, |
| | 25 | :label => AttrCustom + AttrAnno + AttrEvents + [:for, :accesskey, :onfocus, :onblur], |
| | 26 | :select => AttrCustom + AttrAnno + AttrEvents + [:name, :size, :multiple, :disabled, :tabindex, :onfocus, :onblur, :onchange], |
| | 27 | :noscript => AttrCustom + AttrAnno + AttrEvents, |
| | 28 | :style => [:lang, :dir, :id, :type, :media, :title, :space], |
| | 29 | :strong => AttrCustom + AttrAnno + AttrEvents, |
| | 30 | :span => AttrCustom + AttrAnno + AttrEvents, |
| | 31 | :sub => AttrCustom + AttrAnno + AttrEvents, |
| | 32 | :img => AttrCustom + AttrAnno + AttrEvents + [:src, :alt, :longdesc, :height, :width, :usemap, :ismap], |
| | 33 | :title => [:lang, :dir, :id], |
| | 34 | :bdo => AttrCustom + [:title, ] + AttrEvents + [:lang, :dir], |
| | 35 | :tr => [], |
| | 36 | :tbody => [], |
| | 37 | :param => [:id, :name, :value, :valuetype, :type], |
| | 38 | :li => AttrCustom + AttrAnno + AttrEvents, |
| | 39 | :acronym => AttrCustom + AttrAnno + AttrEvents, |
| | 40 | :html => [:lang, :dir, :id, :xmlns], |
| | 41 | :caption => [], |
| | 42 | :tfoot => [], |
| | 43 | :th => [], |
| | 44 | :sup => AttrCustom + AttrAnno + AttrEvents, |
| | 45 | :var => AttrCustom + AttrAnno + AttrEvents, |
| | 46 | :input => AttrCustom + AttrAnno + AttrEvents + [:accesskey, :tabindex, :onfocus, :onblur, :type, :name, :value, :checked, :disabled, :readonly, :size, :maxlength, :src, :alt, :usemap, :onselect, :onchange, :accept], |
| | 47 | :td => AttrCustom + AttrAnno + AttrEvents + [:summary, :width, :border, :frame, :rules, :cellspacing, :cellpadding, :span, :align, :char, :charoff, :valign, :abbr, :axis, :headers, :scope, :rowspan, :colspan], |
| | 48 | :samp => AttrCustom + AttrAnno + AttrEvents, |
| | 49 | :cite => AttrCustom + AttrAnno + AttrEvents, |
| | 50 | :thead => [], |
| | 51 | :body => AttrCustom + AttrAnno + AttrEvents + [:onload, :onunload], |
| | 52 | :map => AttrCustom + [:lang, :dir, ] + AttrEvents + [:title, :name], |
| | 53 | :head => [:lang, :dir, :id, :profile], |
| | 54 | :blockquote => AttrCustom + AttrAnno + AttrEvents + [:cite], |
| | 55 | :fieldset => AttrCustom + AttrAnno + AttrEvents, |
| | 56 | :option => AttrCustom + AttrAnno + AttrEvents + [:selected, :disabled, :label, :value], |
| | 57 | :form => AttrCustom + AttrAnno + AttrEvents + [:action, :method, :enctype, :onsubmit, :onreset, :accept, 'accept-charset'], |
| | 58 | :hr => AttrCustom + AttrAnno + AttrEvents, |
| | 59 | :big => AttrCustom + AttrAnno + AttrEvents, |
| | 60 | :dd => AttrCustom + AttrAnno + AttrEvents, |
| | 61 | :object => AttrCustom + AttrAnno + AttrEvents + [:declare, :classid, :codebase, :data, :type, :codetype, :archive, :standby, :height, :width, :usemap, :name, :tabindex], |
| | 62 | :base => [:href, :id], |
| | 63 | :link => AttrCustom + AttrAnno + AttrEvents + [:charset, :href, :hreflang, :type, :rel, :rev, :media], |
| | 64 | :kbd => AttrCustom + AttrAnno + AttrEvents, |
| | 65 | :br => AttrCustom + [:title], |
| | 66 | :address => AttrCustom + AttrAnno + AttrEvents, |
| | 67 | :optgroup => AttrCustom + AttrAnno + AttrEvents + [:disabled, :label], |
| | 68 | :dt => AttrCustom + AttrAnno + AttrEvents, |
| | 69 | :ins => AttrCustom + AttrAnno + AttrEvents + [:cite, :datetime], |
| | 70 | :b => AttrCustom + AttrAnno + AttrEvents, |
| | 71 | :legend => AttrCustom + AttrAnno + AttrEvents + [:accesskey], |
| | 72 | :abbr => AttrCustom + AttrAnno + AttrEvents, |
| | 73 | :a => AttrCustom + AttrAnno + AttrEvents + [:accesskey, :tabindex, :onfocus, :onblur, :charset, :type, :name, :href, :hreflang, :rel, :rev, :shape, :coords], |
| | 74 | :ol => AttrCustom + AttrAnno + AttrEvents, |
| | 75 | :textarea => AttrCustom + AttrAnno + AttrEvents + [:accesskey, :tabindex, :onfocus, :onblur, :name, :rows, :cols, :disabled, :readonly, :onselect, :onchange], |
| | 76 | :colgroup => [], |
| | 77 | :i => AttrCustom + AttrAnno + AttrEvents, |
| | 78 | :button => AttrCustom + AttrAnno + AttrEvents + [:accesskey, :tabindex, :onfocus, :onblur, :name, :value, :type, :disabled], |
| | 79 | :script => [:id, :charset, :type, :src, :defer, :space], |
| | 80 | :col => [], |
| | 81 | :q => AttrCustom + AttrAnno + AttrEvents + [:cite], |
| | 82 | :p => AttrCustom + AttrAnno + AttrEvents, |
| | 83 | :del => AttrCustom + AttrAnno + AttrEvents + [:cite, :datetime], |
| | 84 | :small => AttrCustom + AttrAnno + AttrEvents, |
| | 85 | :div => AttrCustom + AttrAnno + AttrEvents, |
| | 86 | :tt => AttrCustom + AttrAnno + AttrEvents, |
| | 87 | :ul => AttrCustom + AttrAnno + AttrEvents |
| | 88 | } |
| | 89 | |
| | 90 | # Additional tags found in XHTML 1.0 Transitional |
| | 91 | XHTMLTransitionalTags = XHTMLStrictTags.merge \ |
| | 92 | :strike => AttrCustom + AttrAnno + AttrEvents, |
| | 93 | :center => AttrCustom + AttrAnno + AttrEvents, |
| | 94 | :dir => AttrCustom + AttrAnno + AttrEvents + [:compact], |
| | 95 | :noframes => AttrCustom + AttrAnno + AttrEvents, |
| | 96 | :basefont => [:id, :size, :color, :face], |
| | 97 | :u => AttrCustom + AttrAnno + AttrEvents, |
| | 98 | :menu => AttrCustom + AttrAnno + AttrEvents + [:compact], |
| | 99 | :iframe => AttrCustom + [:title, :longdesc, :name, :src, :frameborder, :marginwidth, :marginheight, :scrolling, :align, :height, :width], |
| | 100 | :font => AttrCustom + AttrAnno + [:size, :color, :face], |
| | 101 | :s => AttrCustom + AttrAnno + AttrEvents, |
| | 102 | :applet => AttrCustom + [:title, :codebase, :archive, :code, :object, :alt, :name, :width, :height, :align, :hspace, :vspace], |
| | 103 | :isindex => AttrCustom + AttrAnno + [:prompt] |
| | 104 | |
| | 105 | # Additional attributes found in XHTML 1.0 Transitional |
| | 106 | { :script => [:language], |
| | 107 | :a => [:target], |
| | 108 | :td => [:bgcolor, :nowrap, :height], |
| | 109 | :p => [:align], |
| | 110 | :h5 => [:align], |
| | 111 | :h3 => [:align], |
| | 112 | :li => [:type, :value], |
| | 113 | :div => [:align], |
| | 114 | :pre => [:onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover, :onmousemove, :onmouseout, :onkeypress, :onkeydown, :onkeyup, :width], |
| | 115 | :body => [:background, :bgcolor, :text, :link, :vlink, :alink], |
| | 116 | :ol => [:type, :compact, :start], |
| | 117 | :h4 => [:align], |
| | 118 | :h2 => [:align], |
| | 119 | :object => [:align, :border, :hspace, :vspace], |
| | 120 | :img => [:name, :align, :border, :hspace, :vspace], |
| | 121 | :link => [:target], |
| | 122 | :legend => [:align], |
| | 123 | :dl => [:compact], |
| | 124 | :input => [:align], |
| | 125 | :h6 => [:align], |
| | 126 | :hr => [:align, :noshade, :size, :width], |
| | 127 | :base => [:target], |
| | 128 | :ul => [:type, :compact], |
| | 129 | :br => [:clear], |
| | 130 | :form => [:name, :target], |
| | 131 | :area => [:target], |
| | 132 | :h1 => [:align] |
| | 133 | }.each do |k, v| |
| | 134 | XHTMLTransitionalTags[k] += v |
| | 135 | end |