Module: Kitchen::Directions::MoveCustomSectionToEocContainer

Defined in:
lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb,
lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb

Overview

rubocop:disable Metrics/ParameterLists More parameters are ok here because these generic classes DRY up a lot of other code

Defined Under Namespace

Classes: V1

Class Method Summary collapse

Class Method Details

.v1(chapter:, metadata_source:, container_key:, uuid_key:, section_selector:, append_to: nil, wrap_section: false, wrap_content: false) ⇒ ElementBase

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.

Parameters:

  • chapter (ChapterElement)

    the chapter in which the section to be moved is contained

  • metadata_source (MetadataElement)

    metadata for the book

  • 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.

  • uuid_key (String)

    the uuid key for the wrapper class, e.g. ‘’.summary’‘

  • section_selector (String)

    the selector for the section to be moved, e.g. ‘’section.summary’‘

  • append_to (ElementBase) (defaults to: nil)

    the element to be appended. Defaults to the value of ‘chapter` param if none given.

Returns:

  • (ElementBase)

    the append_to element with container appended



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb', line 19

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: ,
    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