# frozen_string_literal: true module Kitchen module Directions module BakeExample def self.v1(example:, number:, title_tag:, numbered_solutions: false) example.wrap_children(class: 'body') example.prepend(child: <<~HTML <#{title_tag} class="os-title"> #{I18n.t(:example_label)} #{number} #{title_tag}> HTML ) example.document .pantry(name: :link_text) .store("#{I18n.t(:example_label)} #{number}", label: example.id) example.titles.each do |title| if title.parent.has_class?('os-caption-container') || \ title.parent.has_class?('os-caption') next end title.name = 'h4' end example.exercises.each do |exercise| if (problem = exercise.problem) problem.titles.each { |title| title.name = 'h4' } problem.wrap_children(class: 'os-problem-container') end if (solution = exercise.solution) solution_number = if numbered_solutions "#{exercise.count_in(:example)}" else '' end solution.replace_children(with: <<~HTML