Class: Kitchen::Directions::CompositePageContainer::V1

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/directions/composite_page_container/v1.rb

Instance Method Summary collapse

Instance Method Details

#bake(container_key:, uuid_key:, metadata_source:, content:, append_to:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kitchen/directions/composite_page_container/v1.rb', line 7

def bake(container_key:, uuid_key:, metadata_source:, content:, append_to:)
  @in_composite_chapter = append_to.is?(:composite_chapter)
  @is_eoc = append_to.is?(:chapter) || @in_composite_chapter
  @section = @is_eoc ? 'eoc' : 'eob'
  @title = I18n.t(:"#{@section}.#{container_key}")
  @uuid_key = uuid_key
  @container_class_type = container_key
  @metadata = .children_to_keep.copy
  @content = content
  @main_title_tag = 'h1'

  if @in_composite_chapter
    @main_title_tag = 'h3'
  elsif @is_eoc
    @main_title_tag = 'h2'
  end

  append_to.append(child: render(file:
    '../../templates/composite_page_template.xhtml.erb'))
end