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



2115
2116
2117
# File 'lib/cgi.rb', line 2115

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.



2120
2121
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
# File 'lib/cgi.rb', line 2120

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 += "      def \#{element.downcase}(attributes = {})\n    BEGIN\n      end\n    END\n  end\n\n  # - O EMPTY\n  for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]\n    methods += <<-BEGIN + nOE_element_def(element) + <<-END\n      def \#{element.downcase}(attributes = {})\n    BEGIN\n      end\n    END\n  end\n\n  # O O or - O\n  for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY\n      COLGROUP TR TH TD HEAD]\n    methods += <<-BEGIN + nO_element_def(element) + <<-END\n      def \#{element.downcase}(attributes = {})\n    BEGIN\n      end\n    END\n  end\n  eval(methods)\nend\n" + nn_element_def(element) + ""