class Kitchen::Directions::BakePreface::V1
Public Instance Methods
bake(book:, title_element:)
click to toggle source
# File lib/kitchen/directions/bake_preface/v1.rb, line 5 def bake(book:, title_element:) book.pages('$.preface').each do |page| page.search('div[data-type="description"], div[data-type="abstract"]').each(&:trash) page.titles.each do |title| title.replace_children(with: <<~HTML <span data-type="" itemprop="" class="os-text">#{title.text}</span> HTML ) title.name = title_element end end end