Sha256: aacf4dcde19f1ff0098655e59893a8136ba45e51994e7d145d82feaf90e8196e

Contents?: true

Size: 775 Bytes

Versions: 6

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakeChapterSectionExercises
  class V1
    def bake(chapter:)
      chapter.pages.each do |page|
        page.search('section.section-exercises').each do |section|
          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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openstax_kitchen-5.0.0 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
openstax_kitchen-4.1.1 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
openstax_kitchen-4.1.0 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
openstax_kitchen-4.0.0 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
openstax_kitchen-3.2.0 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
openstax_kitchen-3.1.0 lib/kitchen/directions/bake_chapter_section_exercises/v1.rb