Module: Kitchen::Directions::BakeCustomTitledNotes

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

Class Method Summary collapse

Class Method Details

.bake_note(note:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kitchen/directions/bake_notes/bake_custom_titled_notes.rb', line 18

def self.bake_note(note:)
  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">#{title.children}</span>
      </h3>
    HTML
  )
end

.v1(book:, classes:) ⇒ Object

These notes are baked in a similar way to BakeUnclassifiedNotes. They can use existing title or none. Only difference is that they contain classes.



10
11
12
13
14
15
16
# File 'lib/kitchen/directions/bake_notes/bake_custom_titled_notes.rb', line 10

def self.v1(book:, classes:)
  book.notes.each do |note|
    next unless (note.classes & classes).any?

    bake_note(note: note)
  end
end