openstax_kitchen 3.0.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.md +77 -3
  4. data/Gemfile.lock +13 -14
  5. data/README.md +23 -0
  6. data/codecov.yaml +1 -0
  7. data/docker/ci +0 -1
  8. data/lib/kitchen/book_document.rb +1 -1
  9. data/lib/kitchen/book_element.rb +16 -2
  10. data/lib/kitchen/chapter_element.rb +10 -13
  11. data/lib/kitchen/chapter_element_enumerator.rb +1 -1
  12. data/lib/kitchen/composite_chapter_element.rb +7 -11
  13. data/lib/kitchen/composite_chapter_element_enumerator.rb +21 -0
  14. data/lib/kitchen/composite_page_element.rb +15 -10
  15. data/lib/kitchen/composite_page_element_enumerator.rb +1 -1
  16. data/lib/kitchen/config.rb +14 -0
  17. data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
  18. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
  19. data/lib/kitchen/directions/bake_chapter_introductions.rb +1 -1
  20. data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +16 -0
  21. data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +35 -0
  22. data/lib/kitchen/directions/bake_chapter_key_equations.rb +27 -20
  23. data/lib/kitchen/directions/bake_chapter_references/main.rb +16 -0
  24. data/lib/kitchen/directions/bake_chapter_references/v1.rb +35 -0
  25. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +11 -0
  26. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +28 -0
  27. data/lib/kitchen/directions/bake_chapter_summary.rb +48 -42
  28. data/lib/kitchen/directions/bake_checkpoint.rb +44 -0
  29. data/lib/kitchen/directions/bake_composite_chapters.rb +14 -0
  30. data/lib/kitchen/directions/bake_composite_pages.rb +1 -1
  31. data/lib/kitchen/directions/bake_equations.rb +37 -0
  32. data/lib/kitchen/directions/bake_example.rb +34 -8
  33. data/lib/kitchen/directions/bake_figure.rb +1 -1
  34. data/lib/kitchen/directions/bake_first_elements.rb +16 -0
  35. data/lib/kitchen/directions/bake_footnotes/v1.rb +2 -1
  36. data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
  37. data/lib/kitchen/directions/bake_free_response/main.rb +11 -0
  38. data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
  39. data/lib/kitchen/directions/bake_further_research.rb +59 -0
  40. data/lib/kitchen/directions/bake_index/v1.rb +35 -14
  41. data/lib/kitchen/directions/bake_link_placeholders.rb +1 -1
  42. data/lib/kitchen/directions/bake_non_introduction_pages.rb +26 -0
  43. data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +29 -0
  44. data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +22 -0
  45. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +51 -0
  46. data/lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb +30 -0
  47. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +15 -0
  48. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +47 -0
  49. data/lib/kitchen/directions/bake_numbered_table/main.rb +2 -2
  50. data/lib/kitchen/directions/bake_numbered_table/v1.rb +18 -4
  51. data/lib/kitchen/directions/bake_page_abstracts.rb +16 -0
  52. data/lib/kitchen/directions/bake_references/main.rb +16 -0
  53. data/lib/kitchen/directions/bake_references/v1.rb +48 -0
  54. data/lib/kitchen/directions/bake_stepwise.rb +1 -5
  55. data/lib/kitchen/directions/bake_suggested_reading.rb +5 -0
  56. data/lib/kitchen/directions/bake_theorem/main.rb +11 -0
  57. data/lib/kitchen/directions/bake_theorem/v1.rb +28 -0
  58. data/lib/kitchen/directions/bake_toc.rb +10 -2
  59. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +9 -0
  60. data/lib/kitchen/directions/{bake_exercises → book_answer_key_container}/main.rb +1 -1
  61. data/lib/kitchen/directions/book_answer_key_container/v1.rb +13 -0
  62. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +9 -0
  63. data/lib/kitchen/directions/chapter_review_container/main.rb +11 -0
  64. data/lib/kitchen/directions/chapter_review_container/v1.rb +13 -0
  65. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +20 -0
  66. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +27 -0
  67. data/lib/kitchen/directions/move_exercises_to_eoc/v1.rb +36 -0
  68. data/lib/kitchen/directions/move_exercises_to_eoc/v2.rb +49 -0
  69. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +14 -0
  70. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +19 -0
  71. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +41 -0
  72. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +63 -0
  73. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +34 -0
  74. data/lib/kitchen/document.rb +3 -0
  75. data/lib/kitchen/element.rb +9 -3
  76. data/lib/kitchen/element_base.rb +118 -16
  77. data/lib/kitchen/element_enumerator_base.rb +118 -8
  78. data/lib/kitchen/element_enumerator_factory.rb +28 -12
  79. data/lib/kitchen/element_factory.rb +3 -3
  80. data/lib/kitchen/example_element.rb +8 -11
  81. data/lib/kitchen/example_element_enumerator.rb +1 -1
  82. data/lib/kitchen/exercise_element.rb +42 -0
  83. data/lib/kitchen/exercise_element_enumerator.rb +21 -0
  84. data/lib/kitchen/figure_element.rb +8 -11
  85. data/lib/kitchen/figure_element_enumerator.rb +1 -1
  86. data/lib/kitchen/metadata_element.rb +8 -2
  87. data/lib/kitchen/metadata_element_enumerator.rb +1 -1
  88. data/lib/kitchen/note_element.rb +25 -27
  89. data/lib/kitchen/note_element_enumerator.rb +1 -1
  90. data/lib/kitchen/oven.rb +2 -0
  91. data/lib/kitchen/page_element.rb +33 -9
  92. data/lib/kitchen/page_element_enumerator.rb +1 -1
  93. data/lib/kitchen/patches/nokogiri.rb +55 -0
  94. data/lib/kitchen/patches/nokogiri_profiling.rb +60 -0
  95. data/lib/kitchen/recipe.rb +35 -2
  96. data/lib/kitchen/reference_element.rb +27 -0
  97. data/lib/kitchen/references_element_enumerator.rb +20 -0
  98. data/lib/kitchen/search_query.rb +31 -3
  99. data/lib/kitchen/selector.rb +25 -0
  100. data/lib/kitchen/selectors/base.rb +39 -0
  101. data/lib/kitchen/selectors/standard_1.rb +13 -0
  102. data/lib/kitchen/table_element.rb +8 -11
  103. data/lib/kitchen/table_element_enumerator.rb +1 -1
  104. data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
  105. data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
  106. data/lib/kitchen/term_element.rb +5 -8
  107. data/lib/kitchen/term_element_enumerator.rb +1 -1
  108. data/lib/kitchen/unit_element.rb +13 -7
  109. data/lib/kitchen/unit_element_enumerator.rb +1 -1
  110. data/lib/kitchen/version.rb +1 -1
  111. data/lib/locales/en.yml +12 -7
  112. data/lib/locales/pl.yml +24 -0
  113. data/lib/openstax_kitchen.rb +2 -1
  114. metadata +54 -6
  115. data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -37
  116. data/lib/kitchen/directions/bake_exercises/v1.rb +0 -166
  117. data/lib/kitchen/directions/bake_notes.rb +0 -58
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kitchen
4
- module Directions
5
- module BakeNotes
6
- def self.v1(book:)
7
- book.notes.each do |note|
8
- title = note.title&.cut
9
-
10
- note.replace_children(with:
11
- <<~HTML
12
- <div class="os-note-body">#{note.children}</div>
13
- HTML
14
- )
15
-
16
- if title
17
- if note.indicates_autogenerated_title?
18
- note.prepend(child:
19
- <<~HTML
20
- <h3 class="os-title" data-type="title">
21
- <span class="os-title-label">#{note.autogenerated_title}</span>
22
- </h3>
23
- HTML
24
- )
25
-
26
- title.name = 'h4'
27
- title.add_class('os-subtitle')
28
- title.replace_children(with:
29
- <<~HTML
30
- <span class="os-subtitle-label">#{title.children}</span>
31
- HTML
32
- )
33
- note.first!('.os-note-body').prepend(child: title.raw)
34
- else
35
- title.name = 'h3'
36
- title.add_class('os-title')
37
- title.replace_children(with:
38
- <<~HTML
39
- <span data-type="" id="#{title.id}" class="os-title-label">#{title.children}</span>
40
- HTML
41
- )
42
- title.remove_attribute('id')
43
- note.prepend(child: title.raw)
44
- end
45
- else
46
- note.prepend(child:
47
- <<~HTML
48
- <h3 class="os-title" data-type="title">
49
- <span class="os-title-label">#{note.autogenerated_title}</span>
50
- </h3>
51
- HTML
52
- )
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end