Module: CGI::Html4

Defined in:
lib/cgialt/html.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



901
902
903
# File 'lib/cgialt/html.rb', line 901

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.



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
# File 'lib/cgialt/html.rb', line 906

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