class Kitchen::FigureElement

An element for a figure

Public Class Methods

new(node:, document: nil) click to toggle source

Creates a new FigureElement

@param node [Nokogiri::XML::Node] the node this element wraps @param document [Document] this element's document

Calls superclass method Kitchen::ElementBase::new
# File lib/kitchen/figure_element.rb, line 13
def initialize(node:, document: nil)
  super(node: node,
        document: document,
        enumerator_class: FigureElementEnumerator)
end
short_type() click to toggle source

Returns the short type @return [Symbol]

# File lib/kitchen/figure_element.rb, line 22
def self.short_type
  :figure
end

Public Instance Methods

caption() click to toggle source

Returns the caption element

@return [Element, nil]

# File lib/kitchen/figure_element.rb, line 30
def caption
  first('figcaption')
end
figure_to_bake?() click to toggle source

Returns true unless the figure is a subfigure or has the 'unnumbered' class, unless the figure has both the 'unnumbered' and the 'splash' classes.

@return [Boolean]

# File lib/kitchen/figure_element.rb, line 55
def figure_to_bake?
  return false if subfigure? || (has_class?('unnumbered') && !has_class?('splash'))

  true
end
subfigure?() click to toggle source

Returns true if the figure is a child of another figure

@return [Boolean]

# File lib/kitchen/figure_element.rb, line 46
def subfigure?
  parent.name == 'figure'
end
title() click to toggle source

Returns the Figure Title

@return [Element, nil]

# File lib/kitchen/figure_element.rb, line 38
def title
  first("div[data-type='title']")
end