Module: Kitchen::Directions::BakeStepwise

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

Class Method Summary collapse

Class Method Details

.v1(book:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kitchen/directions/bake_stepwise.rb', line 6

def self.v1(book:)
  book.search('ol.stepwise').each do |ol|
    ol.remove_class('stepwise')
    ol.add_class('os-stepwise')

    ol.search('> li').each_with_index do |li, ii|
      li.wrap_children('span', class: 'os-stepwise-content')
      li.prepend(child:
        <<~HTML
          <span class="os-stepwise-token">#{I18n.t(:stepwise_step_label)} #{ii + 1}. </span>
        HTML
      )
    end
  end
end