Sha256: 8cbef35ee343d5d90ec95cdd2d0d209652f7025c6a77e710c0cb53e0c6fd4876

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakeAnnotationClasses
  class V1
    def bake(chapter:)
      chapter.search('p.annotation').each do |annotation|
        annotation.wrap_children('span', class: 'os-text')
        annotation.prepend(child:
          <<~HTML
            <div class="os-icons"></div>
          HTML
        )
      end
      annotation_icon_classes = %w[linguistic-icon
                                   culture-icon
                                   dreaming-icon
                                   visual-icon
                                   speech-icon
                                   auditory-icon
                                   kinesthetic-icon]
      annotation_icon_classes.each do |annotation_icon_class|
        chapter.search("p.#{annotation_icon_class}").each do |annotation_with_icon_class|
          annotation_with_icon_class.search('div.os-icons').first.append(child:
            <<~HTML
              <span class = "#{annotation_icon_class}"></span>
            HTML
          )
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openstax_kitchen-13.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-12.2.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-12.1.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-12.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-11.2.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-11.1.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-11.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb