Class: Nokogiri::HTML4::ElementDescription
- Inherits:
-
Object
- Object
- Nokogiri::HTML4::ElementDescription
- Defined in:
- lib/nokogiri/html4/element_description.rb,
lib/nokogiri/html4/element_description_defaults.rb,
ext/nokogiri/html4_element_description.c
Defined Under Namespace
Classes: Desc
Constant Summary collapse
- DefaultDescriptions =
This is filled in down below.
{}
- FONTSTYLE =
Attributes defined and categorized
["tt", "i", "b", "u", "s", "strike", "big", "small"]
- PHRASE =
["em", "strong", "dfn", "code", "samp", "kbd", "var", "cite", "abbr", "acronym",]
- SPECIAL =
["a", "img", "applet", "embed", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe",]
- PCDATA =
[]
- HEADING =
["h1", "h2", "h3", "h4", "h5", "h6"]
- LIST =
["ul", "ol", "dir", "menu"]
- FORMCTRL =
["input", "select", "textarea", "label", "button"]
- BLOCK =
[HEADING, LIST, "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address",]
- INLINE =
[PCDATA, FONTSTYLE, PHRASE, SPECIAL, FORMCTRL]
- FLOW =
[BLOCK, INLINE]
- MODIFIER =
[]
- EMPTY =
[]
- HTML_FLOW =
FLOW
- HTML_INLINE =
INLINE
- HTML_PCDATA =
PCDATA
- HTML_CDATA =
HTML_PCDATA
- COREATTRS =
["id", "class", "style", "title"]
- I18N =
["lang", "dir"]
- EVENTS =
["onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmouseout", "onkeypress", "onkeydown", "onkeyup",]
- ATTRS =
[COREATTRS, I18N, EVENTS]
- CELLHALIGN =
["align", "char", "charoff"]
- CELLVALIGN =
["valign"]
- HTML_ATTRS =
ATTRS
- CORE_I18N_ATTRS =
[COREATTRS, I18N]
- CORE_ATTRS =
COREATTRS
- I18N_ATTRS =
I18N
- A_ATTRS =
[ATTRS, "charset", "type", "name", "href", "hreflang", "rel", "rev", "accesskey", "shape", "coords", "tabindex", "onfocus", "onblur",]
- TARGET_ATTR =
["target"]
- ROWS_COLS_ATTR =
["rows", "cols"]
- ALT_ATTR =
["alt"]
- SRC_ALT_ATTRS =
["src", "alt"]
- HREF_ATTRS =
["href"]
- CLEAR_ATTRS =
["clear"]
- INLINE_P =
[INLINE, "p"]
- FLOW_PARAM =
[FLOW, "param"]
- APPLET_ATTRS =
[COREATTRS, "codebase", "archive", "alt", "name", "height", "width", "align", "hspace", "vspace",]
- AREA_ATTRS =
["shape", "coords", "href", "nohref", "tabindex", "accesskey", "onfocus", "onblur",]
- BASEFONT_ATTRS =
["id", "size", "color", "face"]
- QUOTE_ATTRS =
[ATTRS, "cite"]
- BODY_CONTENTS =
[FLOW, "ins", "del"]
- BODY_ATTRS =
[ATTRS, "onload", "onunload"]
- BODY_DEPR =
["background", "bgcolor", "text", "link", "vlink", "alink",]
- BUTTON_ATTRS =
[ATTRS, "name", "value", "type", "disabled", "tabindex", "accesskey", "onfocus", "onblur",]
- COL_ATTRS =
[ATTRS, "span", "width", CELLHALIGN, CELLVALIGN]
- COL_ELT =
["col"]
- EDIT_ATTRS =
[ATTRS, "datetime", "cite"]
- COMPACT_ATTRS =
[ATTRS, "compact"]
- DL_CONTENTS =
["dt", "dd"]
- COMPACT_ATTR =
["compact"]
- LABEL_ATTR =
["label"]
- FIELDSET_CONTENTS =
[FLOW, "legend"]
- FONT_ATTRS =
[COREATTRS, I18N, "size", "color", "face"]
- FORM_CONTENTS =
[HEADING, LIST, INLINE, "pre", "p", "div", "center", "noscript", "noframes", "blockquote", "isindex", "hr", "table", "fieldset", "address",]
- FORM_ATTRS =
[ATTRS, "method", "enctype", "accept", "name", "onsubmit", "onreset", "accept-charset",]
- FRAME_ATTRS =
[COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "noresize", "scrolling",]
- FRAMESET_ATTRS =
[COREATTRS, "rows", "cols", "onload", "onunload"]
- FRAMESET_CONTENTS =
["frameset", "frame", "noframes"]
- HEAD_ATTRS =
[I18N, "profile"]
- HEAD_CONTENTS =
["title", "isindex", "base", "script", "style", "meta", "link", "object",]
- HR_DEPR =
["align", "noshade", "size", "width"]
- VERSION_ATTR =
["version"]
- HTML_CONTENT =
["head", "body", "frameset"]
- IFRAME_ATTRS =
[COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width",]
- IMG_ATTRS =
[ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap",]
- EMBED_ATTRS =
[COREATTRS, "align", "alt", "border", "code", "codebase", "frameborder", "height", "hidden", "hspace", "name", "palette", "pluginspace", "pluginurl", "src", "type", "units", "vspace", "width",]
- INPUT_ATTRS =
[ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept",]
- PROMPT_ATTRS =
[COREATTRS, I18N, "prompt"]
- LABEL_ATTRS =
[ATTRS, "for", "accesskey", "onfocus", "onblur"]
- LEGEND_ATTRS =
[ATTRS, "accesskey"]
- ALIGN_ATTR =
["align"]
- LINK_ATTRS =
[ATTRS, "charset", "href", "hreflang", "type", "rel", "rev", "media",]
- MAP_CONTENTS =
[BLOCK, "area"]
- NAME_ATTR =
["name"]
- ACTION_ATTR =
["action"]
- BLOCKLI_ELT =
[BLOCK, "li"]
- META_ATTRS =
[I18N, "http-equiv", "name", "scheme"]
- CONTENT_ATTR =
["content"]
- TYPE_ATTR =
["type"]
- NOFRAMES_CONTENT =
["body", FLOW, MODIFIER]
- OBJECT_CONTENTS =
[FLOW, "param"]
- OBJECT_ATTRS =
[ATTRS, "declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex",]
- OBJECT_DEPR =
["align", "border", "hspace", "vspace"]
- OL_ATTRS =
["type", "compact", "start"]
- OPTION_ELT =
["option"]
- OPTGROUP_ATTRS =
[ATTRS, "disabled"]
- OPTION_ATTRS =
[ATTRS, "disabled", "label", "selected", "value"]
- PARAM_ATTRS =
["id", "value", "valuetype", "type"]
- WIDTH_ATTR =
["width"]
- PRE_CONTENT =
[PHRASE, "tt", "i", "b", "u", "s", "strike", "a", "br", "script", "map", "q", "span", "bdo", "iframe",]
- SCRIPT_ATTRS =
["charset", "src", "defer", "event", "for"]
- LANGUAGE_ATTR =
["language"]
- SELECT_CONTENT =
["optgroup", "option"]
- SELECT_ATTRS =
[ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange",]
- STYLE_ATTRS =
[I18N, "media", "title"]
- TABLE_ATTRS =
[ATTRS, "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize",]
- TABLE_DEPR =
["align", "bgcolor"]
- TABLE_CONTENTS =
["caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr",]
- TR_ELT =
["tr"]
- TALIGN_ATTRS =
[ATTRS, CELLHALIGN, CELLVALIGN]
- TH_TD_DEPR =
["nowrap", "bgcolor", "width", "height"]
- TH_TD_ATTR =
[ATTRS, "abbr", "axis", "headers", "scope", "rowspan", "colspan", CELLHALIGN, CELLVALIGN,]
- TEXTAREA_ATTRS =
[ATTRS, "name", "disabled", "readonly", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange",]
- TR_CONTENTS =
["th", "td"]
- BGCOLOR_ATTR =
["bgcolor"]
- LI_ELT =
["li"]
- UL_DEPR =
["type", "compact"]
- DIR_ATTR =
["dir"]
Class Method Summary collapse
-
.[](tag_name) ⇒ Object
Get ElemementDescription for
tag_name
.
Instance Method Summary collapse
-
#block? ⇒ Boolean
Is this element a block element?.
-
#default_sub_element ⇒ Object
The default sub element for this element.
-
#deprecated? ⇒ Boolean
Is this element deprecated?.
-
#deprecated_attributes ⇒ Object
A list of deprecated attributes for this element.
-
#description ⇒ Object
The description for this element.
-
#empty? ⇒ Boolean
Is this an empty element?.
-
#implied_end_tag? ⇒ Boolean
Can the end tag be implied for this tag?.
-
#implied_start_tag? ⇒ Boolean
Can the start tag be implied for this tag?.
-
#inline? ⇒ Boolean
Is this element an inline element?.
-
#inspect ⇒ Object
Inspection information.
-
#name ⇒ Object
Get the tag name for this ElemementDescription.
-
#optional_attributes ⇒ Object
A list of optional attributes for this element.
-
#required_attributes ⇒ Object
A list of required attributes for this element.
-
#save_end_tag? ⇒ Boolean
Should the end tag be saved?.
-
#sub_elements ⇒ Object
A list of allowed sub elements for this element.
-
#to_s ⇒ Object
Convert this description to a string.
Class Method Details
.[](tag_name) ⇒ Object
Get ElemementDescription for tag_name
261 262 263 264 265 266 267 268 269 270 |
# File 'ext/nokogiri/html4_element_description.c', line 261
static VALUE
get_description(VALUE klass, VALUE tag_name)
{
const htmlElemDesc *description = htmlTagLookup(
(const xmlChar *)StringValueCStr(tag_name)
);
if (NULL == description) { return Qnil; }
return Data_Wrap_Struct(klass, 0, 0, DISCARD_CONST_QUAL(void *, description));
}
|
Instance Method Details
#block? ⇒ Boolean
Is this element a block element?
8 9 10 |
# File 'lib/nokogiri/html4/element_description.rb', line 8 def block? !inline? end |
#default_sub_element ⇒ Object
The default sub element for this element
89 90 91 92 |
# File 'ext/nokogiri/html4_element_description.c', line 89 def default_sub_element d = default_desc d ? d.defaultsubelt : nil end |
#deprecated? ⇒ Boolean
Is this element deprecated?
165 166 167 168 |
# File 'ext/nokogiri/html4_element_description.c', line 165 def deprecated? d = default_desc d ? d.depr : nil end |
#deprecated_attributes ⇒ Object
A list of deprecated attributes for this element
37 38 39 40 |
# File 'ext/nokogiri/html4_element_description.c', line 37 def deprecated_attributes d = default_desc d ? d.attrs_depr : [] end |
#description ⇒ Object
The description for this element
134 135 136 137 |
# File 'ext/nokogiri/html4_element_description.c', line 134 def description d = default_desc d ? d.desc : nil end |
#empty? ⇒ Boolean
Is this an empty element?
181 182 183 184 185 186 187 188 189 |
# File 'ext/nokogiri/html4_element_description.c', line 181
static VALUE
empty_eh(VALUE self)
{
const htmlElemDesc *description;
Data_Get_Struct(self, htmlElemDesc, description);
if (description->empty) { return Qtrue; }
return Qfalse;
}
|
#implied_end_tag? ⇒ Boolean
Can the end tag be implied for this tag?
213 214 215 216 |
# File 'ext/nokogiri/html4_element_description.c', line 213 def implied_end_tag? d = default_desc d ? d.endTag : nil end |
#implied_start_tag? ⇒ Boolean
Can the start tag be implied for this tag?
229 230 231 232 |
# File 'ext/nokogiri/html4_element_description.c', line 229 def implied_start_tag? d = default_desc d ? d.startTag : nil end |
#inline? ⇒ Boolean
Is this element an inline element?
149 150 151 152 153 154 155 156 157 |
# File 'ext/nokogiri/html4_element_description.c', line 149
static VALUE
inline_eh(VALUE self)
{
const htmlElemDesc *description;
Data_Get_Struct(self, htmlElemDesc, description);
if (description->isinline) { return Qtrue; }
return Qfalse;
}
|
#inspect ⇒ Object
Inspection information
20 21 22 |
# File 'lib/nokogiri/html4/element_description.rb', line 20 def inspect "#<#{self.class.name}: #{name} #{description}>" end |
#name ⇒ Object
Get the tag name for this ElemementDescription
245 246 247 248 249 250 251 252 253 |
# File 'ext/nokogiri/html4_element_description.c', line 245
static VALUE
name(VALUE self)
{
const htmlElemDesc *description;
Data_Get_Struct(self, htmlElemDesc, description);
if (NULL == description->name) { return Qnil; }
return NOKOGIRI_STR_NEW2(description->name);
}
|
#optional_attributes ⇒ Object
A list of optional attributes for this element
63 64 65 66 |
# File 'ext/nokogiri/html4_element_description.c', line 63 def optional_attributes d = default_desc d ? d.attrs_opt : [] end |
#required_attributes ⇒ Object
A list of required attributes for this element
11 12 13 14 |
# File 'ext/nokogiri/html4_element_description.c', line 11 def required_attributes d = default_desc d ? d.attrs_req : [] end |
#save_end_tag? ⇒ Boolean
Should the end tag be saved?
197 198 199 200 |
# File 'ext/nokogiri/html4_element_description.c', line 197 def save_end_tag? d = default_desc d ? d.saveEndTag : nil end |
#sub_elements ⇒ Object
A list of allowed sub elements for this element.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'ext/nokogiri/html4_element_description.c', line 108
static VALUE
sub_elements(VALUE self)
{
const htmlElemDesc *description;
VALUE list;
int i;
Data_Get_Struct(self, htmlElemDesc, description);
list = rb_ary_new();
if (NULL == description->subelts) { return list; }
for (i = 0; description->subelts[i]; i++) {
rb_ary_push(list, NOKOGIRI_STR_NEW2(description->subelts[i]));
}
return list;
}
|
#to_s ⇒ Object
Convert this description to a string
14 15 16 |
# File 'lib/nokogiri/html4/element_description.rb', line 14 def to_s "#{name}: #{description}" end |