Sha256: b3d694a22e66f54e55720bdad14d523c48602d8ce38fb688b6ed119010603699

Contents?: true

Size: 1019 Bytes

Versions: 10

Compression:

Stored size: 1019 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' || \
          title.parent.data_type == 'exercise'
        end
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/example_element.rb
openstax_kitchen-18.0.0 lib/kitchen/example_element.rb
openstax_kitchen-17.1.0 lib/kitchen/example_element.rb
openstax_kitchen-17.0.0 lib/kitchen/example_element.rb
openstax_kitchen-16.0.0 lib/kitchen/example_element.rb
openstax_kitchen-15.0.0 lib/kitchen/example_element.rb
openstax_kitchen-14.0.0 lib/kitchen/example_element.rb
openstax_kitchen-13.0.0 lib/kitchen/example_element.rb
openstax_kitchen-12.2.0 lib/kitchen/example_element.rb
openstax_kitchen-12.1.0 lib/kitchen/example_element.rb