Module: Kitchen::Directions::BakeSuggestedReading

Defined in:
lib/kitchen/directions/bake_suggested_reading.rb

Overview

Bake directions for EOC suggested reading

Class Method Summary collapse

Class Method Details

.v1(book:) ⇒ Object



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

def self.v1(book:)
   = book..children_to_keep.copy
  book.chapters.each do |chapter|
    suggested_reading = chapter.search('section.suggested-reading').cut

    chapter.append(child:
      <<~HTML
        <div class="os-eoc os-suggested-reading-container" data-type="composite-page" data-uuid-key=".suggested-reading">
          <h2 data-type="document-title">
            <span class="os-text">#{I18n.t(:eoc_suggested_reading)}</span>
          </h2>
          <div data-type="metadata" style="display: none;">
            <h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_suggested_reading)}</h1>
            #{.paste}
          </div>
          #{suggested_reading.paste}
        </div>
      HTML
    )
  end
end