27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb', line 27
def bake(chapter:, metadata_source:, append_to:, options:)
@solutions_or_solution = options[:solutions_plural] ? 'solutions' : 'solution'
@uuid_key = if options[:in_appendix]
"appendix#{@solutions_or_solution}#{chapter.count_in(:book)}"
elsif options[:in_preface]
"preface#{@solutions_or_solution}#{chapter.count_in(:book)}"
else
@uuid_key = "#{@solutions_or_solution}#{chapter.count_in(:book)}"
end
@metadata = metadata_source.children_to_keep.copy
@composite_element = 'composite-page'
@title = if options[:in_appendix]
"#{I18n.t("appendix#{'.nominative' if options[:cases]}")} #{[*('A'..'Z')][chapter.count_in(:book) - 1]}"
elsif options[:in_preface]
I18n.t("preface#{'.nominative' if options[:cases]}").to_s
else
"#{I18n.t("chapter#{'.nominative' if options[:cases]}")} #{chapter.count_in(:book)}"
end
@main_title_tag = 'h2'
append_to.append(
child: render(file: '../book_answer_key_container/eob_answer_key_container.xhtml.erb')
).first("div[data-uuid-key='.#{@uuid_key}']")
end
|