openstax_kitchen 14.0.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -3
- data/Gemfile.lock +4 -4
- data/codecov.yaml +4 -0
- data/lib/kitchen/directions/bake_all_chapter_solutions_types.rb +30 -0
- data/lib/kitchen/directions/bake_all_numbered_exercise_types.rb +26 -0
- data/lib/kitchen/directions/bake_annotation_classes/v1.rb +11 -2
- data/lib/kitchen/directions/bake_autotitled_exercise/main.rb +4 -0
- data/lib/kitchen/directions/bake_autotitled_exercise/v3.rb +35 -0
- data/lib/kitchen/directions/bake_chapter_references/main.rb +15 -0
- data/lib/kitchen/directions/bake_chapter_references/v2.rb +53 -0
- data/lib/kitchen/directions/bake_chapter_references/v3.rb +45 -0
- data/lib/kitchen/directions/bake_chapter_summary.rb +5 -4
- data/lib/kitchen/directions/bake_example.rb +1 -1
- data/lib/kitchen/directions/bake_exercise_prefixes/main.rb +14 -0
- data/lib/kitchen/directions/bake_exercise_prefixes/v1.rb +22 -0
- data/lib/kitchen/directions/bake_footnotes/v1.rb +1 -1
- data/lib/kitchen/directions/bake_index/v1.rb +13 -8
- data/lib/kitchen/directions/bake_index/v1.xhtml.erb +6 -10
- data/lib/kitchen/directions/{bake_injected_exercise.rb → bake_injected_exercise/bake_injected_exercise.rb} +10 -1
- data/lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise_question.rb +4 -0
- data/lib/kitchen/directions/bake_link_placeholders.rb +1 -1
- data/lib/kitchen/directions/bake_lo_link_labels.rb +19 -0
- data/lib/kitchen/directions/bake_non_introduction_pages.rb +3 -1
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +8 -3
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +48 -7
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +5 -1
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +2 -1
- data/lib/kitchen/directions/bake_references/v1.rb +13 -0
- data/lib/kitchen/directions/bake_screenreader_spans.rb +22 -0
- data/lib/kitchen/directions/bake_unnumbered_exercise.rb +16 -0
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_container.xhtml.erb +9 -0
- data/lib/kitchen/directions/book_answer_key_container/v1.rb +6 -2
- data/lib/kitchen/directions/default_strategy_for_answer_key_solutions.rb +35 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb +29 -0
- data/lib/kitchen/element_base.rb +25 -5
- data/lib/kitchen/element_enumerator_base.rb +18 -0
- data/lib/kitchen/injected_exercise_element.rb +41 -0
- data/lib/kitchen/injected_exercise_element_enumerator.rb +21 -0
- data/lib/kitchen/injected_question_element.rb +7 -0
- data/lib/kitchen/patches/i18n.rb +4 -0
- data/lib/kitchen/patches/integer.rb +32 -3
- data/lib/kitchen/patches/nokogiri.rb +5 -4
- data/lib/kitchen/patches/renderable.rb +1 -1
- data/lib/kitchen/selectors/base.rb +3 -0
- data/lib/kitchen/selectors/standard_1.rb +1 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +16 -0
- data/lib/locales/es.yml +6 -1
- metadata +18 -11
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +0 -9
- data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +0 -18
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +0 -41
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb +0 -40
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +0 -27
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +0 -63
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +0 -21
- data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +0 -47
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openstax_kitchen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 17.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JP Slavinsky
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -244,12 +244,15 @@ files:
|
|
|
244
244
|
- lib/kitchen/debug/print_recipe_error.rb
|
|
245
245
|
- lib/kitchen/directions/.rubocop.yml
|
|
246
246
|
- lib/kitchen/directions/bake_accessibility_fixes.rb
|
|
247
|
+
- lib/kitchen/directions/bake_all_chapter_solutions_types.rb
|
|
248
|
+
- lib/kitchen/directions/bake_all_numbered_exercise_types.rb
|
|
247
249
|
- lib/kitchen/directions/bake_annotation_classes/main.rb
|
|
248
250
|
- lib/kitchen/directions/bake_annotation_classes/v1.rb
|
|
249
251
|
- lib/kitchen/directions/bake_appendix.rb
|
|
250
252
|
- lib/kitchen/directions/bake_autotitled_exercise/main.rb
|
|
251
253
|
- lib/kitchen/directions/bake_autotitled_exercise/v1.rb
|
|
252
254
|
- lib/kitchen/directions/bake_autotitled_exercise/v2.rb
|
|
255
|
+
- lib/kitchen/directions/bake_autotitled_exercise/v3.rb
|
|
253
256
|
- lib/kitchen/directions/bake_chapter_glossary/main.rb
|
|
254
257
|
- lib/kitchen/directions/bake_chapter_glossary/v1.rb
|
|
255
258
|
- lib/kitchen/directions/bake_chapter_introductions/bake_chapter_objectives.rb
|
|
@@ -262,6 +265,8 @@ files:
|
|
|
262
265
|
- lib/kitchen/directions/bake_chapter_key_equations.rb
|
|
263
266
|
- lib/kitchen/directions/bake_chapter_references/main.rb
|
|
264
267
|
- lib/kitchen/directions/bake_chapter_references/v1.rb
|
|
268
|
+
- lib/kitchen/directions/bake_chapter_references/v2.rb
|
|
269
|
+
- lib/kitchen/directions/bake_chapter_references/v3.rb
|
|
265
270
|
- lib/kitchen/directions/bake_chapter_section_exercises/main.rb
|
|
266
271
|
- lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
|
|
267
272
|
- lib/kitchen/directions/bake_chapter_solutions/main.rb
|
|
@@ -278,6 +283,8 @@ files:
|
|
|
278
283
|
- lib/kitchen/directions/bake_eoc_section_content/remove_section_title.rb
|
|
279
284
|
- lib/kitchen/directions/bake_equations.rb
|
|
280
285
|
- lib/kitchen/directions/bake_example.rb
|
|
286
|
+
- lib/kitchen/directions/bake_exercise_prefixes/main.rb
|
|
287
|
+
- lib/kitchen/directions/bake_exercise_prefixes/v1.rb
|
|
281
288
|
- lib/kitchen/directions/bake_figure.rb
|
|
282
289
|
- lib/kitchen/directions/bake_first_elements.rb
|
|
283
290
|
- lib/kitchen/directions/bake_folio.rb
|
|
@@ -294,13 +301,14 @@ files:
|
|
|
294
301
|
- lib/kitchen/directions/bake_index/main.rb
|
|
295
302
|
- lib/kitchen/directions/bake_index/v1.rb
|
|
296
303
|
- lib/kitchen/directions/bake_index/v1.xhtml.erb
|
|
297
|
-
- lib/kitchen/directions/bake_injected_exercise.rb
|
|
298
304
|
- lib/kitchen/directions/bake_injected_exercise/add_injected_exercise_id.rb
|
|
305
|
+
- lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise.rb
|
|
299
306
|
- lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise_question.rb
|
|
300
307
|
- lib/kitchen/directions/bake_inline_lists.rb
|
|
301
308
|
- lib/kitchen/directions/bake_learning_objectives.rb
|
|
302
309
|
- lib/kitchen/directions/bake_link_placeholders.rb
|
|
303
310
|
- lib/kitchen/directions/bake_lists_with_para.rb
|
|
311
|
+
- lib/kitchen/directions/bake_lo_link_labels.rb
|
|
304
312
|
- lib/kitchen/directions/bake_math_in_paragraph.rb
|
|
305
313
|
- lib/kitchen/directions/bake_non_introduction_pages.rb
|
|
306
314
|
- lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
|
|
@@ -324,6 +332,7 @@ files:
|
|
|
324
332
|
- lib/kitchen/directions/bake_references/v1.rb
|
|
325
333
|
- lib/kitchen/directions/bake_references/v2.rb
|
|
326
334
|
- lib/kitchen/directions/bake_references/v3.rb
|
|
335
|
+
- lib/kitchen/directions/bake_screenreader_spans.rb
|
|
327
336
|
- lib/kitchen/directions/bake_stepwise.rb
|
|
328
337
|
- lib/kitchen/directions/bake_suggested_reading.rb
|
|
329
338
|
- lib/kitchen/directions/bake_toc.rb
|
|
@@ -331,9 +340,10 @@ files:
|
|
|
331
340
|
- lib/kitchen/directions/bake_unit_page_title/v1.rb
|
|
332
341
|
- lib/kitchen/directions/bake_unit_title/main.rb
|
|
333
342
|
- lib/kitchen/directions/bake_unit_title/v1.rb
|
|
343
|
+
- lib/kitchen/directions/bake_unnumbered_exercise.rb
|
|
334
344
|
- lib/kitchen/directions/bake_unnumbered_figure.rb
|
|
335
345
|
- lib/kitchen/directions/bake_unnumbered_tables.rb
|
|
336
|
-
- lib/kitchen/directions/book_answer_key_container/
|
|
346
|
+
- lib/kitchen/directions/book_answer_key_container/eob_answer_key_container.xhtml.erb
|
|
337
347
|
- lib/kitchen/directions/book_answer_key_container/main.rb
|
|
338
348
|
- lib/kitchen/directions/book_answer_key_container/v1.rb
|
|
339
349
|
- lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb
|
|
@@ -341,6 +351,7 @@ files:
|
|
|
341
351
|
- lib/kitchen/directions/chapter_review_container/v1.rb
|
|
342
352
|
- lib/kitchen/directions/composite_page_container/main.rb
|
|
343
353
|
- lib/kitchen/directions/composite_page_container/v1.rb
|
|
354
|
+
- lib/kitchen/directions/default_strategy_for_answer_key_solutions.rb
|
|
344
355
|
- lib/kitchen/directions/eoc_section_title_link_snippet.rb
|
|
345
356
|
- lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
|
|
346
357
|
- lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb
|
|
@@ -348,16 +359,10 @@ files:
|
|
|
348
359
|
- lib/kitchen/directions/move_exercises_to_eoc/v1.rb
|
|
349
360
|
- lib/kitchen/directions/move_exercises_to_eoc/v2.rb
|
|
350
361
|
- lib/kitchen/directions/move_exercises_to_eoc/v3.rb
|
|
351
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/
|
|
362
|
+
- lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
|
|
352
363
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_exercise_section.rb
|
|
353
364
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
|
|
354
365
|
- lib/kitchen/directions/move_solutions_to_answer_key/solution_area_snippet.rb
|
|
355
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb
|
|
356
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb
|
|
357
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb
|
|
358
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb
|
|
359
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb
|
|
360
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/v1.rb
|
|
361
366
|
- lib/kitchen/directions/move_title_text_into_span.rb
|
|
362
367
|
- lib/kitchen/document.rb
|
|
363
368
|
- lib/kitchen/element.rb
|
|
@@ -375,6 +380,8 @@ files:
|
|
|
375
380
|
- lib/kitchen/figure_element_enumerator.rb
|
|
376
381
|
- lib/kitchen/i18n_string.rb
|
|
377
382
|
- lib/kitchen/id_tracker.rb
|
|
383
|
+
- lib/kitchen/injected_exercise_element.rb
|
|
384
|
+
- lib/kitchen/injected_exercise_element_enumerator.rb
|
|
378
385
|
- lib/kitchen/injected_question_element.rb
|
|
379
386
|
- lib/kitchen/injected_question_element_enumerator.rb
|
|
380
387
|
- lib/kitchen/metadata_element.rb
|
data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<div class="os-eob os-<%= @solutions_or_solution %>-container" data-type="composite-chapter" data-uuid-key=".<%= @solutions_or_solution %>">
|
|
2
|
-
<h1 data-type="document-title">
|
|
3
|
-
<span class="os-text"><%= I18n.t(:answer_key_title) %></span>
|
|
4
|
-
</h1>
|
|
5
|
-
<div data-type="metadata" style="display: none;">
|
|
6
|
-
<h1 data-type="document-title" itemprop="name"><%= I18n.t(:answer_key_title) %></h1>
|
|
7
|
-
<%= @metadata.paste %>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen
|
|
4
|
-
module Directions
|
|
5
|
-
module MoveSolutionsToAnswerKey
|
|
6
|
-
def self.v1(chapter:, metadata_source:, strategy:, append_to:, strategy_options: {}, solutions_plural: true)
|
|
7
|
-
V1.new.bake(
|
|
8
|
-
chapter: chapter,
|
|
9
|
-
metadata_source: metadata_source,
|
|
10
|
-
strategy: strategy,
|
|
11
|
-
append_to: append_to,
|
|
12
|
-
strategy_options: strategy_options,
|
|
13
|
-
solutions_plural: solutions_plural
|
|
14
|
-
)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
module Strategies
|
|
5
|
-
class Calculus
|
|
6
|
-
def bake(chapter:, append_to:)
|
|
7
|
-
checkpoint_solutions = chapter.search('div.checkpoint div[data-type="solution"]').cut
|
|
8
|
-
append_solution_area(I18n.t(:checkpoint), checkpoint_solutions, append_to)
|
|
9
|
-
|
|
10
|
-
chapter.search('section.section-exercises').each do |section|
|
|
11
|
-
section_solutions = section.search('div[data-type="solution"]').cut
|
|
12
|
-
section_title = I18n.t(
|
|
13
|
-
:section_exercises,
|
|
14
|
-
number: "#{chapter.count_in(:book)}.#{section.count_in(:chapter)}"
|
|
15
|
-
)
|
|
16
|
-
append_solution_area(section_title, section_solutions, append_to)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
chapter.search('section.review-exercises').each do |section|
|
|
20
|
-
section_solutions = section.search('div[data-type="solution"]').cut
|
|
21
|
-
append_solution_area(I18n.t(:review_exercises), section_solutions, append_to)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
protected
|
|
26
|
-
|
|
27
|
-
def append_solution_area(title, clipboard, append_to)
|
|
28
|
-
append_to.append(child:
|
|
29
|
-
<<~HTML
|
|
30
|
-
<div class="os-solution-area">
|
|
31
|
-
<h3 data-type="title">
|
|
32
|
-
<span class="os-title-label">#{title}</span>
|
|
33
|
-
</h3>
|
|
34
|
-
#{clipboard.paste}
|
|
35
|
-
</div>
|
|
36
|
-
HTML
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
module Strategies
|
|
5
|
-
class ContemporaryMath
|
|
6
|
-
def bake(chapter:, append_to:)
|
|
7
|
-
# Hacky numbering fix
|
|
8
|
-
chapter.notes('$.your-turn').exercises.each do |exercise|
|
|
9
|
-
solution = exercise.solution
|
|
10
|
-
next unless solution
|
|
11
|
-
|
|
12
|
-
number = exercise.ancestor(:note).count_in(:chapter)
|
|
13
|
-
solution.first('a.os-number').inner_html = number.to_s
|
|
14
|
-
solution.first('span.os-divider').inner_html = '. '
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
Kitchen::Directions::MoveSolutionsFromNumberedNote.v1(
|
|
18
|
-
chapter: chapter, append_to: append_to, note_class: 'your-turn'
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
# Bake section exercises
|
|
22
|
-
chapter.non_introduction_pages.each do |page|
|
|
23
|
-
number = "#{chapter.count_in(:book)}.#{page.count_in(:chapter)}"
|
|
24
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
|
25
|
-
chapter: page, append_to: append_to, section_class: 'section-exercises',
|
|
26
|
-
title_number: number
|
|
27
|
-
)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Bake other exercise sections
|
|
31
|
-
classes = %w[chapter-review chapter-test]
|
|
32
|
-
classes.each do |klass|
|
|
33
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
|
34
|
-
chapter: chapter, append_to: append_to, section_class: klass
|
|
35
|
-
)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
module Strategies
|
|
5
|
-
class Default
|
|
6
|
-
def bake(chapter:, append_to:)
|
|
7
|
-
bake_section(chapter: chapter, append_to: append_to)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
protected
|
|
11
|
-
|
|
12
|
-
def bake_section(chapter:, append_to:)
|
|
13
|
-
@selectors.each do |selector|
|
|
14
|
-
chapter.search("#{selector} div[data-type='solution']").each do |solution|
|
|
15
|
-
append_to.append(child: solution.cut.to_s)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# This method helps to obtain more strategy-specific params through
|
|
21
|
-
# "strategy_options: {blah1: 1, blah2: 2}"
|
|
22
|
-
def initialize(strategy_options)
|
|
23
|
-
@selectors = strategy_options[:selectors] || (raise 'missing selectors for strategy')
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
module Strategies
|
|
5
|
-
class Precalculus
|
|
6
|
-
def bake(chapter:, append_to:)
|
|
7
|
-
try_note_solutions(chapter: chapter, append_to: append_to)
|
|
8
|
-
|
|
9
|
-
# Bake section exercises
|
|
10
|
-
chapter.non_introduction_pages.each do |page|
|
|
11
|
-
number = "#{chapter.count_in(:book)}.#{page.count_in(:chapter)}"
|
|
12
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
|
13
|
-
chapter: page, append_to: append_to, section_class: 'section-exercises',
|
|
14
|
-
title_number: number
|
|
15
|
-
)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Bake other types of exercises
|
|
19
|
-
classes = %w[review-exercises practice-test]
|
|
20
|
-
classes.each do |klass|
|
|
21
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
|
22
|
-
chapter: chapter, append_to: append_to, section_class: klass
|
|
23
|
-
)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
protected
|
|
28
|
-
|
|
29
|
-
def try_note_solutions(chapter:, append_to:)
|
|
30
|
-
append_to.append(child:
|
|
31
|
-
<<~HTML
|
|
32
|
-
<div class="os-module-reset-solution-area os-try-solution-area">
|
|
33
|
-
<h3 data-type="title">
|
|
34
|
-
<span class="os-title-label">#{I18n.t(:"notes.try")}</span>
|
|
35
|
-
</h3>
|
|
36
|
-
</div>
|
|
37
|
-
HTML
|
|
38
|
-
)
|
|
39
|
-
chapter.pages.each do |page|
|
|
40
|
-
solutions = Kitchen::Clipboard.new
|
|
41
|
-
page.notes('$.try').each do |note|
|
|
42
|
-
note.exercises.each do |exercise|
|
|
43
|
-
solution = exercise.solution
|
|
44
|
-
solution&.cut(to: solutions)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
next if solutions.items.empty?
|
|
48
|
-
|
|
49
|
-
title_snippet = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(
|
|
50
|
-
page: page,
|
|
51
|
-
wrapper: 'div'
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
append_to.first('div.os-try-solution-area').append(child:
|
|
55
|
-
Kitchen::Directions::SolutionAreaSnippet.v1(
|
|
56
|
-
title: title_snippet, solutions_clipboard: solutions
|
|
57
|
-
)
|
|
58
|
-
)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
module Strategies
|
|
5
|
-
class UPhysics
|
|
6
|
-
def bake(chapter:, append_to:)
|
|
7
|
-
Kitchen::Directions::MoveSolutionsFromNumberedNote.v1(
|
|
8
|
-
chapter: chapter, append_to: append_to, note_class: 'check-understanding'
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
classes = %w[review-conceptual-questions review-problems review-additional-problems
|
|
12
|
-
review-challenge]
|
|
13
|
-
classes.each do |klass|
|
|
14
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
|
15
|
-
chapter: chapter, append_to: append_to, section_class: klass
|
|
16
|
-
)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
4
|
-
class V1
|
|
5
|
-
# rubocop:disable Metrics/ParameterLists
|
|
6
|
-
# This direction may need refactoring to simplify parameters
|
|
7
|
-
def bake(chapter:, metadata_source:, strategy:, append_to:, strategy_options: {},
|
|
8
|
-
solutions_plural: true)
|
|
9
|
-
strategy =
|
|
10
|
-
case strategy
|
|
11
|
-
when :calculus
|
|
12
|
-
Strategies::Calculus.new
|
|
13
|
-
when :contemporary_math
|
|
14
|
-
Strategies::ContemporaryMath.new
|
|
15
|
-
when :uphysics
|
|
16
|
-
Strategies::UPhysics.new
|
|
17
|
-
when :precalculus
|
|
18
|
-
Strategies::Precalculus.new
|
|
19
|
-
when :default
|
|
20
|
-
Strategies::Default.new(strategy_options)
|
|
21
|
-
else
|
|
22
|
-
raise 'No such strategy'
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
solutions_or_solution = solutions_plural ? 'solutions' : 'solution'
|
|
26
|
-
uuid_key = ".#{solutions_or_solution}#{chapter.count_in(:book)}"
|
|
27
|
-
append_to.append(child:
|
|
28
|
-
<<~HTML
|
|
29
|
-
<div class="os-eob os-#{solutions_or_solution}-container" data-type="composite-page" \
|
|
30
|
-
data-uuid-key="#{uuid_key}">
|
|
31
|
-
<h2 data-type="document-title">
|
|
32
|
-
<span class="os-text">#{I18n.t(:chapter)} #{chapter.count_in(:book)}</span>
|
|
33
|
-
</h2>
|
|
34
|
-
<div data-type="metadata" style="display: none;">
|
|
35
|
-
<h1 data-type="document-title" itemprop="name">#{I18n.t(:chapter)} #{chapter.count_in(:book)}</h1>
|
|
36
|
-
#{metadata_source.children_to_keep.copy.paste}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
HTML
|
|
40
|
-
)
|
|
41
|
-
strategy.bake(
|
|
42
|
-
chapter: chapter, append_to: append_to.first("div[data-uuid-key='#{uuid_key}']")
|
|
43
|
-
)
|
|
44
|
-
end
|
|
45
|
-
# rubocop:enable Metrics/ParameterLists
|
|
46
|
-
end
|
|
47
|
-
end
|