Sha256: 3f8580fec9bb5bcdb7c67fe9770aa287d6dd31651677940d6eb205b8d19ef09b

Contents?: true

Size: 971 Bytes

Versions: 5

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  # An element for an example
  #
  class ExampleElement < ElementBase

    # Creates a new +ExampleElement+
    #
    # @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: ExampleElementEnumerator)
    end

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

    # Returns the an enumerator for titles.
    #
    # @return [ElementEnumerator]
    #
    def titles_to_rename
      titles(except: \
        lambda do |title|
          title.parent.has_class?('os-caption-container') || \
          title.parent.has_class?('os-caption') || \
          title.parent.name == 'caption' || \
          title.parent[:'data-type'] == 'note'
        end
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
openstax_kitchen-12.0.0 lib/kitchen/example_element.rb
openstax_kitchen-11.2.0 lib/kitchen/example_element.rb
openstax_kitchen-11.1.0 lib/kitchen/example_element.rb
openstax_kitchen-11.0.0 lib/kitchen/example_element.rb
openstax_kitchen-10.0.0 lib/kitchen/example_element.rb