Module: Kitchen::Directions::BakeUnclassifiedNotes

Defined in:
lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb

Class Method Summary collapse

Class Method Details

.bake_note(note:, bake_exercises:) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb', line 14

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

.v1(book:, bake_exercises: false) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb', line 6

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