Sha256: f825023bf19edb64585c09628a3f351f458f360d41b0071a936397843f2a7a43

Contents?: true

Size: 539 Bytes

Versions: 23

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakePreface
  class V1
    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
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-18.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-17.1.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-13.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-12.2.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-12.1.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-12.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-11.2.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-11.1.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-11.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-10.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-9.2.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-9.1.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-9.0.0 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-8.0.1 lib/kitchen/directions/bake_preface/v1.rb
openstax_kitchen-8.0.0 lib/kitchen/directions/bake_preface/v1.rb