Class: Kitchen::Directions::BakePreface::V1
- Defined in:
- lib/kitchen/directions/bake_preface/v1.rb
Instance Method Summary collapse
Instance Method Details
#bake(book:, title_element:) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# 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: " <span data-type=\"\" itemprop=\"\" class=\"os-text\">\#{title.text}</span>\n HTML\n )\n title.name = title_element\n end\n end\nend\n" |