Module: Kitchen::Directions::BakeNoteSubtitle

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

Class Method Summary collapse

Class Method Details

.v1(note:, cases: false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kitchen/directions/bake_notes/bake_note_subtitle.rb', line 6

def self.v1(note:, cases: false)
  title = note.title&.cut

  return unless title

  # Store label information
  note_label = title.children
  if cases
    note.target_label(label_text: 'note', custom_content: note_label.to_s, cases: cases)
  else
    note.target_label(custom_content: note_label.to_s)
  end

  title.name = 'h4'
  title.add_class('os-subtitle')
  title.wrap_children('span', class: 'os-subtitle-label')
  note.first!('.os-note-body').prepend(child: title.to_s)
end