Sha256: 99cc40382091950fd1f4aadf9aa8fd16d2bfd9a488db748a4284db83881d5610

Contents?: true

Size: 979 Bytes

Versions: 12

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  # An element for a figure
  #
  class FigureElement < ElementBase

    # Creates a new +FigureElement+
    #
    # @param node [Nokogiri::XML::Node] the node this element wraps
    # @param document [Document] this element's document
    #
    def initialize(node:, document: nil)
      super(node: node,
            document: document,
            enumerator_class: FigureElementEnumerator)
    end

    # Returns the short type
    # @return [Symbol]
    #
    def self.short_type
      :figure
    end

    # Returns the caption element
    #
    # @return [Element, nil]
    #
    def caption
      first('figcaption')
    end

    # Returns the Figure Title
    #
    # @return [Element, nil]
    #
    def title
      first("div[data-type='title']")
    end

    # Returns true if the figure is a child of another figure
    #
    # @return [Boolean]
    #
    def subfigure?
      parent.name == 'figure'
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
openstax_kitchen-9.2.0 lib/kitchen/figure_element.rb
openstax_kitchen-9.1.0 lib/kitchen/figure_element.rb
openstax_kitchen-9.0.0 lib/kitchen/figure_element.rb
openstax_kitchen-8.0.1 lib/kitchen/figure_element.rb
openstax_kitchen-8.0.0 lib/kitchen/figure_element.rb
openstax_kitchen-7.0.0 lib/kitchen/figure_element.rb
openstax_kitchen-6.1.0 lib/kitchen/figure_element.rb
openstax_kitchen-6.0.0 lib/kitchen/figure_element.rb
openstax_kitchen-5.0.0 lib/kitchen/figure_element.rb
openstax_kitchen-4.1.1 lib/kitchen/figure_element.rb
openstax_kitchen-4.1.0 lib/kitchen/figure_element.rb
openstax_kitchen-4.0.0 lib/kitchen/figure_element.rb