openstax_kitchen 5.0.0 → 6.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/changelog.yml +27 -0
  3. data/.github/workflows/rubocop.yml +28 -0
  4. data/CHANGELOG.md +33 -0
  5. data/Gemfile.lock +8 -6
  6. data/docker/rubocop +22 -0
  7. data/lib/kitchen/directions/bake_appendix.rb +3 -1
  8. data/lib/kitchen/directions/bake_chapter_introductions.rb +22 -15
  9. data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
  10. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
  11. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
  12. data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
  13. data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
  14. data/lib/kitchen/directions/bake_chapter_summary.rb +13 -6
  15. data/lib/kitchen/directions/bake_example.rb +4 -1
  16. data/lib/kitchen/directions/bake_figure.rb +13 -0
  17. data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
  18. data/lib/kitchen/directions/bake_footnotes/v1.rb +11 -8
  19. data/lib/kitchen/directions/bake_further_research.rb +2 -0
  20. data/lib/kitchen/directions/bake_index/v1.rb +2 -2
  21. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
  22. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
  23. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
  24. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
  25. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
  26. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +10 -1
  27. data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
  28. data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
  29. data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -17
  30. data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
  31. data/lib/kitchen/directions/bake_preface/main.rb +2 -2
  32. data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
  33. data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
  34. data/lib/kitchen/directions/book_answer_key_container/main.rb +2 -2
  35. data/lib/kitchen/directions/book_answer_key_container/v1.rb +4 -3
  36. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +3 -3
  37. data/lib/kitchen/directions/chapter_review_container/main.rb +2 -2
  38. data/lib/kitchen/directions/chapter_review_container/v1.rb +4 -2
  39. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +13 -0
  40. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +10 -0
  41. data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
  42. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +6 -2
  43. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
  44. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
  45. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +11 -7
  46. data/lib/kitchen/element_base.rb +15 -0
  47. data/lib/kitchen/page_element.rb +2 -3
  48. data/lib/kitchen/patches/integer.rb +24 -0
  49. data/lib/kitchen/patches/nokogiri.rb +7 -0
  50. data/lib/kitchen/version.rb +1 -1
  51. data/lib/locales/en.yml +2 -1
  52. data/lib/locales/es.yml +2 -1
  53. data/lib/locales/pl.yml +3 -2
  54. metadata +19 -6
  55. data/.github/config.yml +0 -14
  56. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -51
  57. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +0 -9
  58. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +0 -19
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