Sha256: d402f236388fbf57280cb1b13ba28846e4525851e3632088865ce1e1a23e0ece

Contents?: true

Size: 800 Bytes

Versions: 7

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  module Directions
    module BakeUnclassifiedNotes
      def self.v1(book:, bake_exercises: false)
        book.notes.each do |note|
          next unless note.classes.empty?

          bake_note(note: note, bake_exercises: bake_exercises)
        end
      end

      def self.bake_note(note:, bake_exercises:)
        note.wrap_children(class: 'os-note-body')

        title = note.title&.cut
        return unless title

        note.prepend(child:
          <<~HTML
            <h3 class="os-title" data-type="title">
              <span class="os-title-label" data-type="" id="#{title[:id]}">#{title.children}</span>
            </h3>
          HTML
        )

        BakeNoteExercise.v2(note: note) if bake_exercises
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openstax_kitchen-19.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-18.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-17.1.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-17.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-16.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-15.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
openstax_kitchen-14.0.0 lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb