lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb
# for the try it notes, must be called AFTER bake_exercises
for the try it notes, must be called AFTER bake_exercises
for the try it notes must be called AFTER bake_exercises
def bake(book:, classes:, suppress_solution: true)
        classes.each do |klass|
          book.chapters.pages.notes("$.#{klass}").each do |note|
            note.wrap_children(class: 'os-note-body')
            previous_example = note.previous
            until previous_example.nil? || previous_example[:'data-type'] == 'example'
              previous_example = previous_example.previous
            end
            os_number = previous_example&.first('.os-number')&.children&.to_s
            note.prepend(child:
              <<~HTML
                <h3 class="os-title">
                  <span class="os-title-label">#{note.autogenerated_title}</span>
                  <span class="os-number">#{os_number}</span>
                </h3>
              HTML
            )
            note.title&.trash
            note.exercises.each do |exercise|
              BakeNoteExercise.v1(
                note: note, exercise: exercise, divider: '. ', suppress_solution: suppress_solution
              )
            end
            note.injected_questions.each do |question|
              BakeNoteInjectedQuestion.v1(note: note, question: question)
            end
            note.search("div[data-type='solution']").each&.trash if suppress_solution
          end
        end
      end
def bake ( book : , classes : , suppress_solution : true ) classes . each do | klass | book . chapters . pages . notes ( "$.#{klass}" ) . each do | note | note . wrap_children ( class : 'os-note-body' ) previous_example = note . previous until previous_example . nil? || previous_example [ :' data-type ' ] == 'example' previous_example = previous_example . previous end os_number = previous_example &. first ( '.os-number' ) &. children &. to_s note . prepend ( child : <<~HTML 
                <h3 class="os-title">
                  <span class="os-title-label"> #{ note . autogenerated_title } </span>
                  <span class="os-number"> #{ os_number } </span>
                </h3>
               HTML ) note . title &. trash note . exercises . each do | exercise | BakeNoteExercise . v1 ( note : note , exercise : exercise , divider : '. ' , suppress_solution : suppress_solution ) end note . injected_questions . each do | question | BakeNoteInjectedQuestion . v1 ( note : note , question : question ) end note . search ( "div[data-type='solution']" ) . each &. trash if suppress_solution end end end
for the try it notes, must be called AFTER bake_exercises
for the try it notes must be called AFTER bake_exercises
book
<not_specific>
classes
<not_specific>
suppress_solution
<not_specific>