openstax_kitchen 4.1.1 → 8.0.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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/changelog.yml +24 -0
  3. data/.github/workflows/rubocop.yml +28 -0
  4. data/CHANGELOG.md +62 -0
  5. data/Gemfile.lock +16 -7
  6. data/docker/rubocop +24 -0
  7. data/lib/kitchen/composite_page_element.rb +20 -3
  8. data/lib/kitchen/directions/bake_appendix.rb +3 -1
  9. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +23 -5
  10. data/lib/kitchen/directions/bake_chapter_introductions.rb +22 -15
  11. data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
  12. data/lib/kitchen/directions/bake_chapter_references/main.rb +1 -2
  13. data/lib/kitchen/directions/bake_chapter_references/v1.rb +26 -12
  14. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
  15. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
  16. data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
  17. data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
  18. data/lib/kitchen/directions/bake_chapter_summary.rb +13 -6
  19. data/lib/kitchen/directions/bake_example.rb +11 -2
  20. data/lib/kitchen/directions/bake_figure.rb +13 -0
  21. data/lib/kitchen/directions/bake_first_elements.rb +7 -1
  22. data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
  23. data/lib/kitchen/directions/bake_footnotes/v1.rb +11 -8
  24. data/lib/kitchen/directions/bake_further_research.rb +2 -0
  25. data/lib/kitchen/directions/bake_index/v1.rb +3 -14
  26. data/lib/kitchen/directions/bake_inline_lists.rb +22 -0
  27. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
  28. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
  29. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
  30. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
  31. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
  32. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +10 -1
  33. data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
  34. data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
  35. data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -24
  36. data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
  37. data/lib/kitchen/directions/bake_preface/main.rb +2 -2
  38. data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
  39. data/lib/kitchen/directions/bake_references/main.rb +7 -0
  40. data/lib/kitchen/directions/bake_references/v2.rb +35 -0
  41. data/lib/kitchen/directions/bake_toc.rb +3 -1
  42. data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
  43. data/lib/kitchen/directions/book_answer_key_container/main.rb +2 -2
  44. data/lib/kitchen/directions/book_answer_key_container/v1.rb +4 -3
  45. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +3 -3
  46. data/lib/kitchen/directions/chapter_review_container/main.rb +2 -2
  47. data/lib/kitchen/directions/chapter_review_container/v1.rb +4 -2
  48. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +13 -0
  49. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +10 -0
  50. data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
  51. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +6 -2
  52. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
  53. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
  54. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +11 -7
  55. data/lib/kitchen/document.rb +17 -42
  56. data/lib/kitchen/element_base.rb +31 -7
  57. data/lib/kitchen/i18n_string.rb +16 -0
  58. data/lib/kitchen/id_tracker.rb +68 -0
  59. data/lib/kitchen/oven.rb +3 -1
  60. data/lib/kitchen/page_element.rb +2 -3
  61. data/lib/kitchen/patches/array.rb +15 -0
  62. data/lib/kitchen/patches/i18n.rb +34 -0
  63. data/lib/kitchen/patches/integer.rb +24 -0
  64. data/lib/kitchen/patches/nokogiri.rb +7 -0
  65. data/lib/kitchen/version.rb +1 -1
  66. data/lib/locales/en.yml +2 -1
  67. data/lib/locales/es.yml +33 -0
  68. data/lib/locales/pl.yml +3 -1
  69. data/lib/openstax_kitchen.rb +2 -5
  70. data/openstax_kitchen.gemspec +1 -0
  71. metadata +40 -7
  72. data/.github/config.yml +0 -14
  73. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -51
  74. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +0 -9
  75. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +0 -19
  76. data/lib/kitchen/transliterations.rb +0 -21
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Monkey patches for +Array+
4
+ #
5
+ class Array
6
+
7
+ # Receives a string to add as prefix in each item and returns
8
+ # a new array with the concatenaded strings
9
+ #
10
+ # @return [Array<String>]
11
+ #
12
+ def prefix(string)
13
+ map { |item| "#{string}#{item}" }
14
+ end
15
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'twitter_cldr'
4
+
5
+ # rubocop:disable Style/Documentation
6
+ module I18n
7
+ def self.sort_strings(first, second)
8
+ string_sorter.compare(first, second)
9
+ end
10
+
11
+ def self.string_sorter
12
+ @string_sorter ||= begin
13
+ # TwitterCldr does not know about our :test locale, so substitute the English one
14
+ locale = I18n.locale == :test ? :en : I18n.locale
15
+ TwitterCldr::Collation::Collator.new(locale)
16
+ end
17
+ end
18
+
19
+ def self.clear_string_sorter
20
+ @string_sorter = nil
21
+ end
22
+
23
+ class <<self
24
+ alias_method :original_locale=, :locale=
25
+ end
26
+
27
+ def self.locale=(locale)
28
+ # We wrap the setting of locale so that we can clear the string sorter (so that it
29
+ # gets reset to the new locale the next time it is used)
30
+ clear_string_sorter
31
+ self.original_locale = locale
32
+ end
33
+ end
34
+ # rubocop:enable Style/Documentation
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Monkey patches for +Integer+
4
+ #
5
+ class Integer
6
+ ROMAN_NUMERALS = %w[0 i ii iii iv v vi vii viii ix x xi xii xiii xiv xv xvi xvii xviii xix xx].freeze
7
+
8
+ # Formats as different types of integers, including roman numerals.
9
+ #
10
+ # @return [String]
11
+ #
12
+ def to_format(format)
13
+ case format
14
+ when :arabic
15
+ to_s
16
+ when :roman
17
+ raise 'Unknown conversion to Roman numerals' if self >= ROMAN_NUMERALS.size
18
+
19
+ ROMAN_NUMERALS[self]
20
+ else
21
+ raise 'Unknown integer format'
22
+ end
23
+ end
24
+ end
@@ -67,6 +67,13 @@ module Nokogiri
67
67
  self[:class]&.split || []
68
68
  end
69
69
 
70
+ def previous
71
+ prev = previous_element
72
+ return nil if prev.nil?
73
+
74
+ prev.text? ? prev.previous : prev
75
+ end
76
+
70
77
  def self.selector_to_css_nodes(selector)
71
78
  # No need to parse the same selector more than once.
72
79
  @parsed_selectors ||= {}
@@ -3,5 +3,5 @@
3
3
  # A library for modifying the structure of OpenStax book XML.
4
4
  #
5
5
  module Kitchen
6
- VERSION = '4.1.1'
6
+ VERSION = '8.0.0'
7
7
  end
data/lib/locales/en.yml CHANGED
@@ -16,12 +16,13 @@ en:
16
16
  learning_objectives: Learning Objectives
17
17
  stepwise_step_label: Step
18
18
  references: References
19
+ answer_key_title: Answer Key
19
20
  eoc_chapter_review: Chapter Review
20
21
  eoc_key_terms_title: Key Terms
21
22
  eoc_summary_title: Summary
22
23
  eoc_exercises_title: Exercises
23
24
  eoc_composite_metadata_title: Chapter Review
24
- eoc_answer_key_title: Answer Key
25
+ eoc_solutions_title: Solutions
25
26
  eoc_key_concepts: Key Concepts
26
27
  eoc_key_equations: Key Equations
27
28
  eoc_suggested_reading: Suggestions for Further Study
@@ -0,0 +1,33 @@
1
+ es:
2
+ figure: Figura
3
+ table_label: Tabla
4
+ appendix: Apéndice
5
+ theorem: Teorema
6
+ solution: Solución
7
+ chapter_outline: Esquema Del Capitulo
8
+ toc_title: Contenido
9
+ example_label: Ejemplo
10
+ exercise_label: Ejercicio
11
+ equation: Ecuación
12
+ chapter: Capítulo
13
+ unit: Unidad
14
+ checkpoint: Punto De Control
15
+ chapter_review: Revisión Del Capítulo
16
+ learning_objectives: Objetivos De Aprendizaje
17
+ stepwise_step_label: Paso
18
+ references: Referencias
19
+ answer_key_title: Clave de Respuestas
20
+ eoc_chapter_review: Revisión Del Capítulo
21
+ eoc_key_terms_title: Términos Clave
22
+ eoc_summary_title: Resumen
23
+ eoc_exercises_title: Ejercicios
24
+ eoc_composite_metadata_title: Revisión Del Capítulo
25
+ eoc_solutions_title: Soluciones
26
+ eoc_key_concepts: Conceptos Clave
27
+ eoc_key_equations: Ecuaciones Clave
28
+ eoc_suggested_reading: Sugerencias Para Estudios Adicionales
29
+ eoc_further_research_title: Investigación Adicional
30
+ eob_index_title: Índice
31
+ eob_index_symbols_group: Símbolos
32
+ review_exercises: Ejercicios De Repaso
33
+ section_exercises: ! 'Sección %{number} Ejercicios'
data/lib/locales/pl.yml CHANGED
@@ -14,11 +14,13 @@ pl:
14
14
  chapter_review: Podsumowanie rozdziału
15
15
  learning_objectives: Cel dydaktyczny
16
16
  stepwise_step_label: Krok
17
+ answer_key_title: Rozwiązania zadań
17
18
  eoc_chapter_review: Podsumowanie rozdziału
18
19
  eoc_key_terms_title: Kluczowe pojęcia
20
+ eoc_solutions_title: Rozwiązania
19
21
  eoc_summary_title: Podsumowanie
20
- eoc_answer_key_title: Rozwiązania zadań
21
22
  eoc_key_equations: Najważniejsze wzory
22
23
  eob_index_title: Skorowidz rzeczowy
23
24
  eob_index_symbols_group: Symbole
25
+ references: Bibliografia
24
26
 
@@ -25,7 +25,6 @@ require 'kitchen/selectors/base'
25
25
  require_all('kitchen/selectors')
26
26
 
27
27
  require 'kitchen/utils'
28
- require 'kitchen/transliterations'
29
28
  require 'kitchen/errors'
30
29
  require 'kitchen/ancestor'
31
30
  require 'kitchen/search_query'
@@ -41,6 +40,8 @@ require 'kitchen/clipboard'
41
40
  require 'kitchen/pantry'
42
41
  require 'kitchen/counter'
43
42
  require 'kitchen/selector'
43
+ require 'kitchen/id_tracker'
44
+ require 'kitchen/i18n_string'
44
45
 
45
46
  require 'kitchen/element_enumerator_base'
46
47
  require 'kitchen/element_enumerator_factory'
@@ -53,7 +54,3 @@ require 'kitchen/element_factory'
53
54
  require_all('kitchen/directions')
54
55
 
55
56
  I18n.backend.load_translations(file_glob('/locales/*.yml'))
56
-
57
- I18n.available_locales.each do |available_locale|
58
- I18n.backend.store_translations(available_locale, Kitchen::TRANSLITERATIONS)
59
- end
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency 'i18n'
34
34
  spec.add_dependency 'nokogiri'
35
35
  spec.add_dependency 'rainbow'
36
+ spec.add_dependency 'twitter_cldr'
36
37
 
37
38
  spec.add_development_dependency 'byebug'
38
39
  spec.add_development_dependency 'inch'
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.1.1
4
+ version: 8.0.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-05-24 00:00:00.000000000 Z
11
+ date: 2021-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: twitter_cldr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: byebug
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +200,8 @@ extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
188
202
  - ".devcontainer/devcontainer.json"
189
- - ".github/config.yml"
203
+ - ".github/workflows/changelog.yml"
204
+ - ".github/workflows/rubocop.yml"
190
205
  - ".github/workflows/tests.yml"
191
206
  - ".gitignore"
192
207
  - ".inch.yml"
@@ -208,6 +223,7 @@ files:
208
223
  - docker/bash
209
224
  - docker/build
210
225
  - docker/ci
226
+ - docker/rubocop
211
227
  - docker/run
212
228
  - docker/tag_and_push_latest
213
229
  - lefthook.yml
@@ -231,6 +247,7 @@ files:
231
247
  - lib/kitchen/directions/bake_chapter_glossary/main.rb
232
248
  - lib/kitchen/directions/bake_chapter_glossary/v1.rb
233
249
  - lib/kitchen/directions/bake_chapter_introductions.rb
250
+ - lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb
234
251
  - lib/kitchen/directions/bake_chapter_key_concepts/main.rb
235
252
  - lib/kitchen/directions/bake_chapter_key_concepts/v1.rb
236
253
  - lib/kitchen/directions/bake_chapter_key_equations.rb
@@ -238,6 +255,8 @@ files:
238
255
  - lib/kitchen/directions/bake_chapter_references/v1.rb
239
256
  - lib/kitchen/directions/bake_chapter_section_exercises/main.rb
240
257
  - lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
258
+ - lib/kitchen/directions/bake_chapter_solutions/main.rb
259
+ - lib/kitchen/directions/bake_chapter_solutions/v1.rb
241
260
  - lib/kitchen/directions/bake_chapter_summary.rb
242
261
  - lib/kitchen/directions/bake_chapter_title/main.rb
243
262
  - lib/kitchen/directions/bake_chapter_title/v1.rb
@@ -257,22 +276,29 @@ files:
257
276
  - lib/kitchen/directions/bake_index/main.rb
258
277
  - lib/kitchen/directions/bake_index/v1.rb
259
278
  - lib/kitchen/directions/bake_index/v1.xhtml.erb
279
+ - lib/kitchen/directions/bake_inline_lists.rb
260
280
  - lib/kitchen/directions/bake_link_placeholders.rb
261
281
  - lib/kitchen/directions/bake_math_in_paragraph.rb
262
282
  - lib/kitchen/directions/bake_non_introduction_pages.rb
263
283
  - lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
264
284
  - lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
265
- - lib/kitchen/directions/bake_notes/bake_numbered_notes.rb
285
+ - lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb
286
+ - lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb
287
+ - lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb
288
+ - lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb
266
289
  - lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
267
290
  - lib/kitchen/directions/bake_numbered_exercise/main.rb
268
291
  - lib/kitchen/directions/bake_numbered_exercise/v1.rb
292
+ - lib/kitchen/directions/bake_numbered_table/bake_table_body.rb
269
293
  - lib/kitchen/directions/bake_numbered_table/main.rb
270
294
  - lib/kitchen/directions/bake_numbered_table/v1.rb
295
+ - lib/kitchen/directions/bake_numbered_table/v2.rb
271
296
  - lib/kitchen/directions/bake_page_abstracts.rb
272
297
  - lib/kitchen/directions/bake_preface/main.rb
273
298
  - lib/kitchen/directions/bake_preface/v1.rb
274
299
  - lib/kitchen/directions/bake_references/main.rb
275
300
  - lib/kitchen/directions/bake_references/v1.rb
301
+ - lib/kitchen/directions/bake_references/v2.rb
276
302
  - lib/kitchen/directions/bake_stepwise.rb
277
303
  - lib/kitchen/directions/bake_suggested_reading.rb
278
304
  - lib/kitchen/directions/bake_theorem/main.rb
@@ -281,7 +307,7 @@ files:
281
307
  - lib/kitchen/directions/bake_unit_title/main.rb
282
308
  - lib/kitchen/directions/bake_unit_title/v1.rb
283
309
  - lib/kitchen/directions/bake_unnumbered_tables.rb
284
- - lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb
310
+ - lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb
285
311
  - lib/kitchen/directions/book_answer_key_container/main.rb
286
312
  - lib/kitchen/directions/book_answer_key_container/v1.rb
287
313
  - lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb
@@ -291,9 +317,11 @@ files:
291
317
  - lib/kitchen/directions/move_exercises_to_eoc/main.rb
292
318
  - lib/kitchen/directions/move_exercises_to_eoc/v1.rb
293
319
  - lib/kitchen/directions/move_exercises_to_eoc/v2.rb
320
+ - lib/kitchen/directions/move_exercises_to_eoc/v3.rb
294
321
  - lib/kitchen/directions/move_solutions_to_answer_key/main.rb
295
- - lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb
296
322
  - lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb
323
+ - lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb
324
+ - lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb
297
325
  - lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb
298
326
  - lib/kitchen/directions/move_solutions_to_answer_key/v1.rb
299
327
  - lib/kitchen/directions/move_title_text_into_span.rb
@@ -311,6 +339,8 @@ files:
311
339
  - lib/kitchen/exercise_element_enumerator.rb
312
340
  - lib/kitchen/figure_element.rb
313
341
  - lib/kitchen/figure_element_enumerator.rb
342
+ - lib/kitchen/i18n_string.rb
343
+ - lib/kitchen/id_tracker.rb
314
344
  - lib/kitchen/metadata_element.rb
315
345
  - lib/kitchen/metadata_element_enumerator.rb
316
346
  - lib/kitchen/mixins/block_error_if.rb
@@ -320,6 +350,9 @@ files:
320
350
  - lib/kitchen/page_element.rb
321
351
  - lib/kitchen/page_element_enumerator.rb
322
352
  - lib/kitchen/pantry.rb
353
+ - lib/kitchen/patches/array.rb
354
+ - lib/kitchen/patches/i18n.rb
355
+ - lib/kitchen/patches/integer.rb
323
356
  - lib/kitchen/patches/nokogiri.rb
324
357
  - lib/kitchen/patches/nokogiri_profiling.rb
325
358
  - lib/kitchen/patches/renderable.rb
@@ -338,13 +371,13 @@ files:
338
371
  - lib/kitchen/templates/eoc_section_title_template.xhtml.erb
339
372
  - lib/kitchen/term_element.rb
340
373
  - lib/kitchen/term_element_enumerator.rb
341
- - lib/kitchen/transliterations.rb
342
374
  - lib/kitchen/type_casting_element_enumerator.rb
343
375
  - lib/kitchen/unit_element.rb
344
376
  - lib/kitchen/unit_element_enumerator.rb
345
377
  - lib/kitchen/utils.rb
346
378
  - lib/kitchen/version.rb
347
379
  - lib/locales/en.yml
380
+ - lib/locales/es.yml
348
381
  - lib/locales/pl.yml
349
382
  - lib/notes.md
350
383
  - lib/openstax_kitchen.rb
data/.github/config.yml DELETED
@@ -1,14 +0,0 @@
1
- # See https://github.com/openstax/staxly#plugins for more options for this file
2
- changelog:
3
- # See https://github.com/mikz/probot-changelog for details
4
-
5
- # The filename of the CHANGELOG that needs to be updated in every PullRequest
6
- filename: CHANGELOG.md
7
-
8
- # (optional) when files matching these patterns are changed then disallow merging
9
- # until the CHANGELOG is updated.
10
- # If this pattern is not included then **all** Pull Requests require an edit to
11
- # the CHANGELOG file
12
-
13
- # include:
14
- # - /^src\//
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kitchen
4
- module Directions
5
- module BakeNumberedNotes
6
- def self.v1(book:, classes:)
7
- classes.each do |klass|
8
- book.chapters.notes("$.#{klass}").each do |note|
9
- bake_note(note: note)
10
- note.exercises.each do |exercise|
11
- bake_note_exercise(note: note, exercise: exercise)
12
- end
13
- end
14
- end
15
- end
16
-
17
- def self.bake_note(note:)
18
- note.wrap_children(class: 'os-note-body')
19
-
20
- chapter_count = note.ancestor(:chapter).count_in(:book)
21
- note_count = note.count_in(:chapter)
22
- note.prepend(child:
23
- <<~HTML
24
- <h3 class="os-title">
25
- <span class="os-title-label">#{note.autogenerated_title}</span>
26
- <span class="os-number">#{chapter_count}.#{note_count}</span>
27
- <span class="os-divider"> </span>
28
- </h3>
29
- HTML
30
- )
31
-
32
- return unless note['use-subtitle']
33
-
34
- BakeNoteSubtitle.v1(note: note)
35
- end
36
-
37
- def self.bake_note_exercise(note:, exercise:)
38
- exercise.add_class('unnumbered')
39
- # bake problem
40
- exercise.problem.wrap_children('div', class: 'os-problem-container')
41
- exercise.problem.first('strong')&.trash
42
- exercise.search('[data-type="commentary"]').each(&:trash)
43
- return unless exercise.solution
44
-
45
- # bake solution in place
46
- BakeNumberedExercise.bake_solution_v1(
47
- exercise: exercise, number: note.first('.os-number').text, divider: ' ')
48
- end
49
- end
50
- end
51
- end
@@ -1,9 +0,0 @@
1
- <div class="os-eob os-solutions-container" data-type="composite-chapter" data-uuid-key=".solutions">
2
- <h1 data-type="document-title">
3
- <span class="os-text"><%= I18n.t(:eoc_answer_key_title) %></span>
4
- </h1>
5
- <div data-type="metadata" style="display: none;">
6
- <h1 data-type="document-title" itemprop="name"><%= I18n.t(:eoc_answer_key_title) %></h1>
7
- <%= @metadata.paste %>
8
- </div>
9
- </div>
@@ -1,19 +0,0 @@
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