Sha256: a0256c8721c00d74bac9067f97f51a7d85c28cad92b948c5073fde2f9d38d5bb
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true module Kitchen module Directions module BakeAutotitledNotes 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 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 ) bake_unclassified_exercises(note: note) if bake_exercises end def self.bake_unclassified_exercises(note:) note.exercises.each do |exercise| exercise.problem.wrap_children('div', class: 'os-problem-container') exercise.problem.prepend(child: <<~HTML <span class="os-title-label">#{I18n.t(:"exercises.exercise")} </span> <span class="os-number">#{exercise.count_in(:note)}</span> HTML ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openstax_kitchen-12.1.0 | lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb |
openstax_kitchen-12.0.0 | lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb |