openstax_kitchen 3.2.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +42 -1
- data/Gemfile.lock +13 -14
- data/docker/ci +0 -1
- data/lib/kitchen/book_element.rb +16 -2
- data/lib/kitchen/chapter_element.rb +8 -11
- data/lib/kitchen/chapter_element_enumerator.rb +1 -1
- data/lib/kitchen/composite_chapter_element.rb +7 -11
- data/lib/kitchen/composite_page_element.rb +15 -10
- data/lib/kitchen/composite_page_element_enumerator.rb +1 -1
- data/lib/kitchen/config.rb +7 -0
- data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
- data/lib/kitchen/directions/bake_chapter_introductions.rb +1 -1
- data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +7 -2
- data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +12 -7
- data/lib/kitchen/directions/bake_chapter_key_equations.rb +26 -21
- data/lib/kitchen/directions/bake_chapter_summary.rb +48 -42
- data/lib/kitchen/directions/bake_equations.rb +1 -1
- data/lib/kitchen/directions/bake_example.rb +5 -1
- data/lib/kitchen/directions/bake_figure.rb +1 -1
- data/lib/kitchen/directions/{bake_problem_first_elements.rb → bake_first_elements.rb} +2 -2
- data/lib/kitchen/directions/bake_footnotes/v1.rb +2 -1
- data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
- data/lib/kitchen/directions/bake_free_response/main.rb +11 -0
- data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
- data/lib/kitchen/directions/bake_further_research.rb +59 -0
- data/lib/kitchen/directions/bake_index/v1.rb +35 -14
- data/lib/kitchen/directions/bake_link_placeholders.rb +1 -1
- data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +4 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +9 -21
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +6 -2
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +25 -12
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -1
- data/lib/kitchen/directions/bake_page_abstracts.rb +1 -1
- data/lib/kitchen/directions/bake_references/main.rb +16 -0
- data/lib/kitchen/directions/bake_references/v1.rb +48 -0
- data/lib/kitchen/directions/bake_suggested_reading.rb +5 -0
- data/lib/kitchen/directions/bake_toc.rb +4 -2
- data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/eob_solutions_container.xhtml.erb +0 -0
- data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/main.rb +1 -1
- data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/v1.rb +1 -1
- data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/chapter_review.xhtml.erb +0 -0
- data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/main.rb +1 -1
- data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/v1.rb +1 -1
- data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +1 -1
- data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +27 -0
- data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v1.rb +8 -10
- data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v2.rb +8 -9
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/main.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +19 -0
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/calculus.rb +1 -1
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/uphysics.rb +5 -3
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/v1.rb +3 -1
- data/lib/kitchen/document.rb +11 -0
- data/lib/kitchen/element.rb +9 -3
- data/lib/kitchen/element_base.rb +61 -10
- data/lib/kitchen/element_enumerator_base.rb +9 -1
- data/lib/kitchen/element_enumerator_factory.rb +9 -5
- data/lib/kitchen/element_factory.rb +3 -3
- data/lib/kitchen/example_element.rb +8 -11
- data/lib/kitchen/example_element_enumerator.rb +1 -1
- data/lib/kitchen/exercise_element.rb +5 -8
- data/lib/kitchen/exercise_element_enumerator.rb +1 -1
- data/lib/kitchen/figure_element.rb +8 -11
- data/lib/kitchen/figure_element_enumerator.rb +1 -1
- data/lib/kitchen/metadata_element.rb +8 -2
- data/lib/kitchen/metadata_element_enumerator.rb +1 -1
- data/lib/kitchen/note_element.rb +8 -11
- data/lib/kitchen/note_element_enumerator.rb +1 -1
- data/lib/kitchen/page_element.rb +20 -7
- data/lib/kitchen/page_element_enumerator.rb +1 -1
- data/lib/kitchen/reference_element.rb +27 -0
- data/lib/kitchen/references_element_enumerator.rb +20 -0
- data/lib/kitchen/search_query.rb +25 -3
- data/lib/kitchen/selector.rb +24 -0
- data/lib/kitchen/selectors/base.rb +39 -0
- data/lib/kitchen/selectors/standard_1.rb +13 -0
- data/lib/kitchen/table_element.rb +8 -11
- data/lib/kitchen/table_element_enumerator.rb +1 -1
- data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/term_element.rb +5 -8
- data/lib/kitchen/term_element_enumerator.rb +1 -1
- data/lib/kitchen/unit_element.rb +13 -7
- data/lib/kitchen/unit_element_enumerator.rb +1 -1
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +3 -0
- data/lib/openstax_kitchen.rb +1 -0
- metadata +30 -22
- data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -39
- data/lib/kitchen/directions/bake_chapter_key_concepts/key_concepts.xhtml.erb +0 -16
- data/lib/kitchen/directions/bake_chapter_review_exercises/main.rb +0 -15
- data/lib/kitchen/directions/bake_chapter_review_exercises/review_exercises.xhtml.erb +0 -10
- data/lib/kitchen/directions/bake_exercises/main.rb +0 -12
- data/lib/kitchen/directions/bake_exercises/v1.rb +0 -169
- data/lib/kitchen/directions/bake_notes/bake_notes.rb +0 -48
@@ -3,8 +3,12 @@
|
|
3
3
|
module Kitchen
|
4
4
|
module Directions
|
5
5
|
module BakeNumberedExercise
|
6
|
-
def self.v1(exercise:, number:)
|
7
|
-
V1.new.bake(exercise: exercise, number: number)
|
6
|
+
def self.v1(exercise:, number:, suppress_solution: false)
|
7
|
+
V1.new.bake(exercise: exercise, number: number, suppress_solution: suppress_solution)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.bake_solution_v1(exercise:, number:, divider: '. ')
|
11
|
+
V1.new.bake_solution(exercise: exercise, number: number, divider: divider)
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
@@ -2,24 +2,23 @@
|
|
2
2
|
|
3
3
|
module Kitchen::Directions::BakeNumberedExercise
|
4
4
|
class V1
|
5
|
-
def bake(exercise:, number:)
|
5
|
+
def bake(exercise:, number:, suppress_solution: false)
|
6
6
|
problem = exercise.problem
|
7
7
|
solution = exercise.solution
|
8
8
|
|
9
|
+
exercise.pantry(name: :link_text).store(
|
10
|
+
"#{I18n.t(:exercise_label)} #{exercise.ancestor(:chapter).count_in(:book)}.#{number}",
|
11
|
+
label: exercise.id
|
12
|
+
)
|
9
13
|
problem_number = "<span class='os-number'>#{number}</span>"
|
10
14
|
|
11
15
|
if solution.present?
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<a class='os-number' href='##{exercise.id}'>#{number}</a>
|
19
|
-
<span class='os-divider'>. </span>
|
20
|
-
<div class="os-solution-container">#{solution.children}</div>
|
21
|
-
HTML
|
22
|
-
)
|
16
|
+
if suppress_solution
|
17
|
+
solution.trash
|
18
|
+
else
|
19
|
+
problem_number = "<a class='os-number' href='##{exercise.id}-solution'>#{number}</a>"
|
20
|
+
bake_solution(exercise: exercise, number: number)
|
21
|
+
end
|
23
22
|
end
|
24
23
|
|
25
24
|
problem.replace_children(with:
|
@@ -30,5 +29,19 @@ module Kitchen::Directions::BakeNumberedExercise
|
|
30
29
|
HTML
|
31
30
|
)
|
32
31
|
end
|
32
|
+
|
33
|
+
def bake_solution(exercise:, number:, divider: '. ')
|
34
|
+
solution = exercise.solution
|
35
|
+
solution.id = "#{exercise.id}-solution"
|
36
|
+
exercise.add_class('os-hasSolution')
|
37
|
+
|
38
|
+
solution.replace_children(with:
|
39
|
+
<<~HTML
|
40
|
+
<a class='os-number' href='##{exercise.id}'>#{number}</a>
|
41
|
+
<span class='os-divider'>#{divider}</span>
|
42
|
+
<div class="os-solution-container">#{solution.children}</div>
|
43
|
+
HTML
|
44
|
+
)
|
45
|
+
end
|
33
46
|
end
|
34
47
|
end
|
@@ -7,7 +7,7 @@ module Kitchen::Directions::BakeNumberedTable
|
|
7
7
|
table.wrap(%(<div class="os-table">))
|
8
8
|
|
9
9
|
table_label = "#{I18n.t(:table_label)} #{number}"
|
10
|
-
table.
|
10
|
+
table.pantry(name: :link_text).store table_label, label: table.id
|
11
11
|
|
12
12
|
if table.top_titled?
|
13
13
|
table.parent.add_class('os-top-titled-container')
|
@@ -19,7 +19,7 @@ module Kitchen
|
|
19
19
|
li.replace_children(with:
|
20
20
|
<<~HTML
|
21
21
|
<span class="os-abstract-token">#{chapter.count_in(:book)}.#{abstract.count_in(:chapter)}.#{index + 1}</span>
|
22
|
-
<span class="os-abstract-content">#{li.
|
22
|
+
<span class="os-abstract-content">#{li.children}</span>
|
23
23
|
HTML
|
24
24
|
)
|
25
25
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
# Bake directions for EOB references
|
6
|
+
#
|
7
|
+
module BakeReferences
|
8
|
+
def self.v1(book:, metadata_source:)
|
9
|
+
V1.new.bake(
|
10
|
+
book: book,
|
11
|
+
metadata_source: metadata_source
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BakeReferences
|
4
|
+
class V1
|
5
|
+
renderable
|
6
|
+
|
7
|
+
def bake(book:, metadata_source:)
|
8
|
+
@metadata = metadata_source.children_to_keep.copy
|
9
|
+
@klass = 'reference'
|
10
|
+
@uuid_prefix = '.'
|
11
|
+
@title = I18n.t(:references)
|
12
|
+
|
13
|
+
book.chapters.each do |chapter|
|
14
|
+
chapter.search('[data-type="cite"]').each do |link|
|
15
|
+
link.prepend(child:
|
16
|
+
<<~HTML
|
17
|
+
<sup class="os-citation-number">#{link.count_in(:chapter)}</sup>
|
18
|
+
HTML
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
chapter.references.each do |reference|
|
23
|
+
reference.prepend(child:
|
24
|
+
<<~HTML.chomp
|
25
|
+
<span class="os-reference-number">#{reference.count_in(:chapter)}. </span>
|
26
|
+
HTML
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
chapter_references = chapter.pages.references.cut
|
31
|
+
chapter_title_no_num = chapter.title.search('.os-text')
|
32
|
+
|
33
|
+
chapter.append(child:
|
34
|
+
<<~HTML
|
35
|
+
<div class="os-chapter-area">
|
36
|
+
<h2 data-type="document-title">#{chapter_title_no_num}</h2>
|
37
|
+
#{chapter_references.paste}
|
38
|
+
</div>
|
39
|
+
HTML
|
40
|
+
)
|
41
|
+
end
|
42
|
+
chapter_area_references = book.chapters.search('.os-chapter-area').cut
|
43
|
+
@content = chapter_area_references.paste
|
44
|
+
book.body.append(child: render(file:
|
45
|
+
'../../templates/eob_section_title_template.xhtml.erb'))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -6,6 +6,7 @@ module Kitchen
|
|
6
6
|
#
|
7
7
|
module BakeSuggestedReading
|
8
8
|
def self.v1(book:)
|
9
|
+
metadata_elements = book.metadata.children_to_keep.copy
|
9
10
|
book.chapters.each do |chapter|
|
10
11
|
suggested_reading = chapter.search('section.suggested-reading').cut
|
11
12
|
|
@@ -15,6 +16,10 @@ module Kitchen
|
|
15
16
|
<h2 data-type="document-title">
|
16
17
|
<span class="os-text">#{I18n.t(:eoc_suggested_reading)}</span>
|
17
18
|
</h2>
|
19
|
+
<div data-type="metadata" style="display: none;">
|
20
|
+
<h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_suggested_reading)}</h1>
|
21
|
+
#{metadata_elements.paste}
|
22
|
+
</div>
|
18
23
|
#{suggested_reading.paste}
|
19
24
|
</div>
|
20
25
|
HTML
|
@@ -31,9 +31,9 @@ module Kitchen
|
|
31
31
|
<<~HTML
|
32
32
|
<li cnx-archive-uri="" cnx-archive-shortid="" class="os-toc-unit">
|
33
33
|
<a href="#">
|
34
|
-
<span class="os-number"><span class="os-part-text">#{I18n.t(:unit)} </span
|
34
|
+
<span class="os-number"><span class="os-part-text">#{I18n.t(:unit)} </span>#{unit.count_in(:book)}</span>
|
35
35
|
<span class="os-divider"> </span>
|
36
|
-
<span data-type itemprop class="os-text"
|
36
|
+
<span data-type itemprop class="os-text">#{unit.title_text}</span>
|
37
37
|
</a>
|
38
38
|
<ol class="os-unit">
|
39
39
|
#{chapters.map { |chapter| li_for_chapter(chapter) }.join("\n")}
|
@@ -96,6 +96,8 @@ module Kitchen
|
|
96
96
|
when CompositePageElement
|
97
97
|
if page.is_index?
|
98
98
|
'os-toc-index'
|
99
|
+
elsif page.is_reference?
|
100
|
+
'os-toc-reference'
|
99
101
|
elsif page.has_ancestor?(:composite_chapter) || page.has_ancestor?(:chapter)
|
100
102
|
'os-toc-chapter-composite-page'
|
101
103
|
else
|
File without changes
|
File without changes
|
@@ -10,7 +10,7 @@ module Kitchen
|
|
10
10
|
<h3 data-type="document-title" id="#{page.title.copied_id}">
|
11
11
|
<span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter)}</span>
|
12
12
|
<span class="os-divider"> </span>
|
13
|
-
<span class="os-text" data-type="" itemprop="">#{page.
|
13
|
+
<span class="os-text" data-type="" itemprop="">#{page.title_text}</span>
|
14
14
|
</h3>
|
15
15
|
</a>
|
16
16
|
HTML
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
module MoveExercisesToEOC
|
6
|
+
def self.v1(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.')
|
7
|
+
V1.new.bake(
|
8
|
+
chapter: chapter,
|
9
|
+
metadata_source: metadata_source,
|
10
|
+
append_to: append_to,
|
11
|
+
klass: klass,
|
12
|
+
uuid_prefix: uuid_prefix
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.v2(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.')
|
17
|
+
V2.new.bake(
|
18
|
+
chapter: chapter,
|
19
|
+
metadata_source: metadata_source,
|
20
|
+
append_to: append_to,
|
21
|
+
klass: klass,
|
22
|
+
uuid_prefix: uuid_prefix
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Kitchen::Directions::
|
3
|
+
module Kitchen::Directions::MoveExercisesToEOC
|
4
4
|
class V1
|
5
5
|
renderable
|
6
6
|
|
7
|
-
def bake(chapter:, metadata_source:,
|
7
|
+
def bake(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.')
|
8
8
|
@klass = klass
|
9
9
|
@metadata = metadata_source.children_to_keep.copy
|
10
10
|
@title = I18n.t(:"eoc.#{klass}")
|
11
|
+
@uuid_prefix = uuid_prefix
|
11
12
|
|
12
13
|
exercise_clipboard = Kitchen::Clipboard.new
|
13
14
|
|
@@ -17,13 +18,6 @@ module Kitchen::Directions::BakeChapterReviewExercises
|
|
17
18
|
sections.each do |exercise_section|
|
18
19
|
exercise_section.first("[data-type='title']")&.trash
|
19
20
|
|
20
|
-
exercise_section.exercises.each do |exercise|
|
21
|
-
exercise.document.pantry(name: :link_text).store(
|
22
|
-
"#{I18n.t(:exercise_label)} #{chapter.count_in(:book)}.#{exercise.count_in(:chapter)}",
|
23
|
-
label: exercise.id
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
21
|
exercise_section.cut(to: exercise_clipboard)
|
28
22
|
end
|
29
23
|
end
|
@@ -32,7 +26,11 @@ module Kitchen::Directions::BakeChapterReviewExercises
|
|
32
26
|
|
33
27
|
@content = exercise_clipboard.paste
|
34
28
|
|
35
|
-
append_to
|
29
|
+
append_to_element = append_to || chapter
|
30
|
+
@in_composite_chapter = append_to_element.is?(:composite_chapter)
|
31
|
+
|
32
|
+
append_to_element.append(child: render(file:
|
33
|
+
'../../templates/eoc_section_title_template.xhtml.erb'))
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Kitchen::Directions::
|
3
|
+
module Kitchen::Directions::MoveExercisesToEOC
|
4
4
|
# Main difference from v1 is the presence of a section title
|
5
5
|
# and some additional wrappers
|
6
6
|
class V2
|
7
7
|
renderable
|
8
8
|
|
9
|
-
def bake(chapter:, metadata_source:,
|
9
|
+
def bake(chapter:, metadata_source:, klass:, append_to: nil, uuid_prefix: '.')
|
10
10
|
@klass = klass
|
11
11
|
@metadata = metadata_source.children_to_keep.copy
|
12
12
|
@title = I18n.t(:"eoc.#{klass}")
|
13
|
+
@uuid_prefix = uuid_prefix
|
13
14
|
|
14
15
|
exercise_clipboard = Kitchen::Clipboard.new
|
15
16
|
|
@@ -21,12 +22,6 @@ module Kitchen::Directions::BakeChapterReviewExercises
|
|
21
22
|
|
22
23
|
# Get parent page title
|
23
24
|
section_title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: page)
|
24
|
-
exercise_section.exercises.each do |exercise|
|
25
|
-
exercise.document.pantry(name: :link_text).store(
|
26
|
-
"#{I18n.t(:exercise_label)} #{chapter.count_in(:book)}.#{exercise.count_in(:chapter)}",
|
27
|
-
label: exercise.id
|
28
|
-
)
|
29
|
-
end
|
30
25
|
|
31
26
|
# Configure section title & wrappers
|
32
27
|
exercise_section.prepend(child: section_title)
|
@@ -44,7 +39,11 @@ module Kitchen::Directions::BakeChapterReviewExercises
|
|
44
39
|
</div>
|
45
40
|
HTML
|
46
41
|
|
47
|
-
append_to
|
42
|
+
append_to_element = append_to || chapter
|
43
|
+
@in_composite_chapter = append_to_element[:'data-type'] == 'composite-chapter'
|
44
|
+
|
45
|
+
append_to_element.append(child: render(file:
|
46
|
+
'../../templates/eoc_section_title_template.xhtml.erb'))
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
|
+
module Strategies
|
5
|
+
class AmericanGovernment
|
6
|
+
def bake(chapter:, append_to:)
|
7
|
+
bake_section(chapter: chapter, append_to: append_to, klass: 'review-questions')
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def bake_section(chapter:, append_to:, klass:)
|
13
|
+
chapter.search(".#{klass} [data-type='solution']").each do |solution|
|
14
|
+
append_to.add_child(solution.cut.to_s)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Kitchen::Directions::
|
3
|
+
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
4
|
module Strategies
|
5
5
|
class UPhysics
|
6
6
|
def bake(chapter:, append_to:)
|
@@ -32,8 +32,10 @@ module Kitchen::Directions::BakeChapterAnswerKey
|
|
32
32
|
def bake_from_notes(chapter:, append_to:, klass:)
|
33
33
|
solutions = []
|
34
34
|
chapter.notes(".#{klass}").each do |note|
|
35
|
-
|
36
|
-
|
35
|
+
note.exercises.each do |exercise|
|
36
|
+
solution = exercise.solution
|
37
|
+
solutions.push(solution.cut) if solution
|
38
|
+
end
|
37
39
|
end
|
38
40
|
return if solutions.empty?
|
39
41
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module Kitchen::Directions::
|
3
|
+
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
4
|
class V1
|
5
5
|
def bake(chapter:, metadata_source:, strategy:, append_to:)
|
6
6
|
strategy =
|
@@ -9,6 +9,8 @@ module Kitchen::Directions::BakeChapterAnswerKey
|
|
9
9
|
Strategies::Calculus
|
10
10
|
when :uphysics
|
11
11
|
Strategies::UPhysics
|
12
|
+
when :american_government
|
13
|
+
Strategies::AmericanGovernment
|
12
14
|
else
|
13
15
|
raise 'No such strategy'
|
14
16
|
end
|