class Kitchen::Directions::BakeChapterSectionExercises::V1
Public Instance Methods
bake(chapter:, trash_title:)
click to toggle source
# File lib/kitchen/directions/bake_chapter_section_exercises/v1.rb, line 5 def bake(chapter:, trash_title:) chapter.pages.each do |page| page.search('section.section-exercises').each do |section| section.first('h3[data-type="title"]')&.trash if trash_title section.wrap( %(<div class="os-eos os-section-exercises-container" data-uuid-key=".section-exercises">) ) section_title = I18n.t( :section_exercises, number: "#{chapter.count_in(:book)}.#{section.count_in(:chapter)}") section.prepend(sibling: <<~HTML <h3 data-type="document-title"> <span class="os-text">#{section_title}</span> </h3> HTML ) end end end