Module: Kitchen::Directions::BakeAutotitledNotes
- Defined in:
- lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
Class Method Summary collapse
- .bake_note(note:, bake_subtitle:, cases:, bake_exercises:) ⇒ Object
- .v1(book:, classes:, bake_subtitle: true, cases: false, bake_exercises: false) ⇒ Object
Class Method Details
.bake_note(note:, bake_subtitle:, cases:, bake_exercises:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb', line 15 def self.bake_note(note:, bake_subtitle:, cases:, bake_exercises:) Kitchen::Directions::BakeIframes.v1(outer_element: note) note.wrap_children(class: 'os-note-body') if bake_subtitle BakeNoteSubtitle.v1(note: note, cases: cases) else note.title&.trash end note.prepend(child: <<~HTML <h3 class="os-title" data-type="title"> <span class="os-title-label">#{note.autogenerated_title}</span> </h3> HTML ) BakeNoteExercise.v2(note: note) if bake_exercises end |
.v1(book:, classes:, bake_subtitle: true, cases: false, bake_exercises: false) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb', line 6 def self.v1(book:, classes:, bake_subtitle: true, cases: false, bake_exercises: false) book.notes.each do |note| next unless (note.classes & classes).any? bake_note( note: note, bake_subtitle: bake_subtitle, cases: cases, bake_exercises: bake_exercises) end end |