Sha256: a4ed1c390445b24c60184b310b09721a1639c8e76c45864a06e317f050b13862

Contents?: true

Size: 545 Bytes

Versions: 12

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakeUnitPageTitle
  class V1
    def bake(book:)
      book.units.each do |unit|
        unit.element_children.only(Kitchen::PageElement).each do |page|
          compose_unit_page_title(page: page)
        end
      end
    end

    def compose_unit_page_title(page:)
      title = page.title
      title.name = 'h2'
      title.replace_children(with:
        <<~HTML
          <span data-type="" itemprop="" class="os-text">#{title.text}</span>
        HTML
      )
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
openstax_kitchen-17.1.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-13.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-12.2.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-12.1.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-12.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-11.2.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-11.1.0 lib/kitchen/directions/bake_unit_page_title/v1.rb
openstax_kitchen-11.0.0 lib/kitchen/directions/bake_unit_page_title/v1.rb