Module: CGI::Html5
- Defined in:
- lib/cgi/html.rb
Overview
Mixin module for HTML version 5 generation methods.
Instance Method Summary collapse
-
#doctype ⇒ Object
The DOCTYPE declaration for this version of HTML.
-
#element_init ⇒ Object
Initialise the HTML generation methods for this version.
Instance Method Details
#doctype ⇒ Object
The DOCTYPE declaration for this version of HTML
1029 1030 1031 |
# File 'lib/cgi/html.rb', line 1029 def doctype %|<!DOCTYPE HTML>| end |
#element_init ⇒ Object
Initialise the HTML generation methods for this version.
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
# File 'lib/cgi/html.rb', line 1034 def element_init extend TagMaker return if defined?(html) methods = "" # - - for element in %w[ SECTION NAV ARTICLE ASIDE HGROUP HEADER FOOTER FIGURE FIGCAPTION S TIME U MARK RUBY BDI IFRAME VIDEO AUDIO CANVAS DATALIST OUTPUT PROGRESS METER DETAILS SUMMARY MENU DIALOG I B SMALL EM STRONG DFN CODE SAMP KBD VAR CITE ABBR SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT 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 COMMAND EMBED KEYGEN SOURCE TRACK WBR ]\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 HEAD BODY P DT DD LI OPTION THEAD TFOOT TBODY\n OPTGROUP COLGROUP RT RP TR TH TD ]\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) + "" |