Class: Nokogiri::HTML::ElementDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/nokogiri/html/element_description.rb,
lib/nokogiri/ffi/html/element_description.rb,
ext/nokogiri/html_element_description.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cstructObject

:nodoc:



5
6
7
# File 'lib/nokogiri/ffi/html/element_description.rb', line 5

def cstruct
  @cstruct
end

Class Method Details

.[](tag_name) ⇒ Object

Get ElemementDescription for tag_name



59
60
61
62
63
64
65
66
# File 'lib/nokogiri/ffi/html/element_description.rb', line 59

def self.[](tag_name) # :nodoc:
  ptr = LibXML.htmlTagLookup(tag_name)
  return nil if ptr.null?

  desc = allocate
  desc.cstruct = LibXML::HtmlElemDesc.new(ptr)
  desc
end

Instance Method Details

#block?Boolean

Is this element a block element?

Returns:

  • (Boolean)


6
7
8
# File 'lib/nokogiri/html/element_description.rb', line 6

def block?
  !inline?
end

#default_sub_elementObject

The default sub element for this element



19
20
21
# File 'lib/nokogiri/ffi/html/element_description.rb', line 19

def default_sub_element # :nodoc:
  cstruct[:defaultsubelt]
end

#deprecated?Boolean

Is this element deprecated?

Returns:

  • (Boolean)


35
36
37
# File 'lib/nokogiri/ffi/html/element_description.rb', line 35

def deprecated? # :nodoc:
  cstruct[:depr] != 0
end

#deprecated_attributesObject

A list of deprecated attributes for this element



11
12
13
# File 'lib/nokogiri/ffi/html/element_description.rb', line 11

def deprecated_attributes # :nodoc:
  get_string_array_from :attrs_depr
end

#descriptionObject

The description for this element



27
28
29
# File 'lib/nokogiri/ffi/html/element_description.rb', line 27

def description # :nodoc:
  cstruct[:desc]
end

#empty?Boolean

Is this an empty element?

Returns:

  • (Boolean)


39
40
41
# File 'lib/nokogiri/ffi/html/element_description.rb', line 39

def empty? # :nodoc:
  cstruct[:empty] != 0
end

#implied_end_tag?Boolean

Can the end tag be implied for this tag?

Returns:

  • (Boolean)


47
48
49
# File 'lib/nokogiri/ffi/html/element_description.rb', line 47

def implied_end_tag? # :nodoc:
  cstruct[:endTag] != 0
end

#implied_start_tag?Boolean

Can the start tag be implied for this tag?

Returns:

  • (Boolean)


51
52
53
# File 'lib/nokogiri/ffi/html/element_description.rb', line 51

def implied_start_tag? # :nodoc:
  cstruct[:startTag] != 0
end

#inline?Boolean

Is this element an inline element?

Returns:

  • (Boolean)


31
32
33
# File 'lib/nokogiri/ffi/html/element_description.rb', line 31

def inline? # :nodoc:
  cstruct[:isinline] != 0
end

#inspectObject

Inspection information



18
19
20
# File 'lib/nokogiri/html/element_description.rb', line 18

def inspect
  "#<#{self.class.name}: #{name} #{description}>"
end

#nameObject

Get the tag name for this ElemementDescription



55
56
57
# File 'lib/nokogiri/ffi/html/element_description.rb', line 55

def name # :nodoc:
  cstruct[:name]
end

#optional_attributesObject

A list of optional attributes for this element



15
16
17
# File 'lib/nokogiri/ffi/html/element_description.rb', line 15

def optional_attributes # :nodoc:
  get_string_array_from :attrs_opt
end

#required_attributesObject

A list of required attributes for this element



7
8
9
# File 'lib/nokogiri/ffi/html/element_description.rb', line 7

def required_attributes # :nodoc:
  get_string_array_from :attrs_req
end

#save_end_tag?Boolean

Should the end tag be saved?

Returns:

  • (Boolean)


43
44
45
# File 'lib/nokogiri/ffi/html/element_description.rb', line 43

def save_end_tag? # :nodoc:
  cstruct[:saveEndTag] != 0
end

#sub_elementsObject

A list of allowed sub elements for this element.



23
24
25
# File 'lib/nokogiri/ffi/html/element_description.rb', line 23

def sub_elements # :nodoc:
  get_string_array_from :subelts
end

#to_sObject

Convert this description to a string



12
13
14
# File 'lib/nokogiri/html/element_description.rb', line 12

def to_s
  "#{name}: #{description}"
end