Sha256: 554cef64100f6b0db69f1d3713b6a031d43ae5e14c155740b6f33da161224bfb

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  module Directions
    module BakeAutotitledNotes
      def self.v1(book:, classes:, bake_subtitle: true, cases: false)
        book.notes.each do |note|
          next unless (note.classes & classes).any?

          bake_note(note: note, bake_subtitle: bake_subtitle, cases: cases)
        end
      end

      def self.bake_note(note:, bake_subtitle:, cases:)
        Kitchen::Directions::BakeIframes.v1(outer_element: note)
        note.wrap_children(class: 'os-note-body')

        BakeNoteSubtitle.v1(note: note, cases: cases) if bake_subtitle

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openstax_kitchen-11.2.0 lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb