Sha256: 09f2216ca0165a4e180955e710f6da6fa5c2c69628eb286e9b60e34ffb0fe965

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakeAnnotationClasses
  class V1
    def bake(book:)
      book.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|
        book.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

3 entries across 3 versions & 1 rubygems

Version Path
openstax_kitchen-16.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/bake_annotation_classes/v1.rb