# frozen_string_literal: true module Kitchen::Directions::BakeNumberedNotes class V1 def bake(book:, classes:) classes.each do |klass| book.chapters.notes("$.#{klass}").each do |note| bake_note(note: note) note.exercises.each do |exercise| Kitchen::Directions::BakeNumberedNotes.bake_note_exercise(note: note, exercise: exercise) end end end end def bake_note(note:) note.wrap_children(class: 'os-note-body') chapter_count = note.ancestor(:chapter).count_in(:book) note_count = note.count_in(:chapter) note.prepend(child: <<~HTML