Module: CGI::Html4

Defined in:
lib/cgi.rb

Overview

Mixin module for HTML version 4 generation methods.

Instance Method Summary collapse

Instance Method Details

#doctypeObject

The DOCTYPE declaration for this version of HTML



2117
2118
2119
# File 'lib/cgi.rb', line 2117

def doctype
  %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|
end

#element_initObject

Initialise the HTML generation methods for this version.



2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
# File 'lib/cgi.rb', line 2122

def element_init
  extend TagMaker
  methods = ""
  # - -
  for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD
    VAR CITE ABBR ACRONYM SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
    H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT OPTGROUP
    FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
    TEXTAREA FORM A BLOCKQUOTE CAPTION ]
    methods += <<-BEGIN + nn_element_def(element) + <<-END
      end
    END
  end

  # - O EMPTY
  for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]
    methods += <<-BEGIN + nOE_element_def(element) + <<-END
      end
    END
  end

  # O O or - O
  for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
      COLGROUP TR TH TD HEAD]
    methods += <<-BEGIN + nO_element_def(element) + <<-END
      end
    END
  end
  eval(methods)
end