# frozen_string_literal: true module Kitchen module Directions module BakeExample def self.v1(example:, number:, title_tag:, numbered_solutions: false, cases: false) example.wrap_children(class: 'body') example.prepend(child: <<~HTML <#{title_tag} class="os-title"> #{I18n.t("example#{'.nominative' if cases}")} #{number} #{title_tag}> HTML ) # Store label information example.target_label(label_text: 'example', custom_content: number, cases: cases) example.titles_to_rename.each do |title| title.name = 'h4' end example.exercises.each do |exercise| next if exercise.baked? if (problem = exercise.problem) problem.wrap_children(class: 'os-problem-container') end exercise.solutions.each do |solution| solution_number = if numbered_solutions "#{solution.count_in(:example)}" else '' end solution.replace_children(with: <<~HTML