Sha256: 9192ef45180d3c99816d8c760ad72c32907fc149f26b600bcefc034a51bde598

Contents?: true

Size: 1.79 KB

Versions: 14

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

# rubocop:disable Metrics/ParameterLists
# More parameters are ok here because these generic classes DRY up a lot of other code
module Kitchen
  module Directions
    module MoveCustomSectionToEocContainer
      # Creates a custom eoc composite page for a section within the given chapter.
      # The sections are moved into this composite page, and can be transformed before the moved by an optional block argument.
      #
      # @param chapter [ChapterElement] the chapter in which the section to be moved is contained
      # @param metadata_source [MetadataElement] metadata for the book
      # @param container_key [String] Appended to 'eoc.' to form the I18n key for the container title; also used as part of a class on the container.
      # @param uuid_key [String] the uuid key for the wrapper class, e.g. `'.summary'`
      # @param section_selector [String] the selector for the section to be moved, e.g. `'section.summary'`
      # @param append_to [ElementBase] the element to be appended. Defaults to the value of `chapter` param if none given.
      # @return [ElementBase] the append_to element with container appended
      #
      def self.v1(chapter:, metadata_source:, container_key:, uuid_key:,
                  section_selector:, append_to: nil,
                  wrap_section: false, wrap_content: false)
        V1.new.bake(
          chapter: chapter,
          metadata_source: metadata_source,
          container_key: container_key,
          uuid_key: uuid_key,
          section_selector: section_selector,
          append_to: append_to || chapter,
          wrap_section: wrap_section,
          wrap_content: wrap_content
        ) do |section|
          yield section if block_given?
        end
      end
    end
  end
end
# rubocop:enable Metrics/ParameterLists

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-18.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-17.1.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-13.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-12.2.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-12.1.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-12.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-11.2.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-11.1.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
openstax_kitchen-11.0.0 lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb