openstax_kitchen 2.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/devcontainer.json +37 -17
  3. data/.github/config.yml +14 -0
  4. data/.github/workflows/tests.yml +5 -15
  5. data/.gitignore +2 -2
  6. data/.inch.yml +6 -0
  7. data/.rubocop.yml +65 -0
  8. data/CHANGELOG.md +85 -1
  9. data/Gemfile +5 -3
  10. data/Gemfile.lock +65 -17
  11. data/README.md +65 -11
  12. data/Rakefile +5 -3
  13. data/bin/console +4 -3
  14. data/docker/Dockerfile +36 -0
  15. data/docker/Dockerfile.ci +10 -0
  16. data/docker/bash +5 -1
  17. data/docker/build +10 -0
  18. data/docker/ci +15 -0
  19. data/docker/run +9 -0
  20. data/docker/tag_and_push_latest +17 -0
  21. data/lefthook.yml +6 -0
  22. data/lib/kitchen/ancestor.rb +38 -1
  23. data/lib/kitchen/book_document.rb +20 -2
  24. data/lib/kitchen/book_element.rb +40 -5
  25. data/lib/kitchen/book_element_enumerator.rb +4 -0
  26. data/lib/kitchen/book_recipe.rb +15 -1
  27. data/lib/kitchen/chapter_element.rb +43 -6
  28. data/lib/kitchen/chapter_element_enumerator.rb +9 -1
  29. data/lib/kitchen/clipboard.rb +35 -4
  30. data/lib/kitchen/composite_chapter_element.rb +21 -6
  31. data/lib/kitchen/composite_page_element.rb +35 -7
  32. data/lib/kitchen/composite_page_element_enumerator.rb +9 -1
  33. data/lib/kitchen/config.rb +20 -6
  34. data/lib/kitchen/counter.rb +9 -2
  35. data/lib/kitchen/debug/print_recipe_error.rb +53 -35
  36. data/lib/kitchen/directions/.rubocop.yml +22 -0
  37. data/lib/kitchen/directions/bake_appendix.rb +4 -4
  38. data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
  39. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
  40. data/lib/kitchen/directions/bake_chapter_introductions.rb +7 -7
  41. data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +16 -0
  42. data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +35 -0
  43. data/lib/kitchen/directions/bake_chapter_key_equations.rb +30 -20
  44. data/lib/kitchen/directions/bake_chapter_references/main.rb +16 -0
  45. data/lib/kitchen/directions/bake_chapter_references/v1.rb +35 -0
  46. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +11 -0
  47. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +28 -0
  48. data/lib/kitchen/directions/bake_chapter_summary.rb +45 -36
  49. data/lib/kitchen/directions/bake_chapter_title/main.rb +11 -0
  50. data/lib/kitchen/directions/bake_chapter_title/v1.rb +24 -0
  51. data/lib/kitchen/directions/bake_checkpoint.rb +44 -0
  52. data/lib/kitchen/directions/bake_composite_chapters.rb +14 -0
  53. data/lib/kitchen/directions/bake_composite_pages.rb +2 -2
  54. data/lib/kitchen/directions/bake_equations.rb +37 -0
  55. data/lib/kitchen/directions/bake_example.rb +39 -11
  56. data/lib/kitchen/directions/bake_figure.rb +8 -5
  57. data/lib/kitchen/directions/bake_first_elements.rb +16 -0
  58. data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
  59. data/lib/kitchen/directions/bake_footnotes/v1.rb +6 -5
  60. data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
  61. data/lib/kitchen/directions/bake_free_response/main.rb +11 -0
  62. data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
  63. data/lib/kitchen/directions/bake_further_research.rb +59 -0
  64. data/lib/kitchen/directions/bake_index/main.rb +2 -2
  65. data/lib/kitchen/directions/bake_index/v1.rb +46 -18
  66. data/lib/kitchen/directions/bake_link_placeholders.rb +24 -0
  67. data/lib/kitchen/directions/bake_math_in_paragraph.rb +5 -3
  68. data/lib/kitchen/directions/bake_non_introduction_pages.rb +26 -0
  69. data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +29 -0
  70. data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +22 -0
  71. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +51 -0
  72. data/lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb +30 -0
  73. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +15 -0
  74. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +47 -0
  75. data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -4
  76. data/lib/kitchen/directions/bake_numbered_table/v1.rb +37 -18
  77. data/lib/kitchen/directions/bake_page_abstracts.rb +30 -0
  78. data/lib/kitchen/directions/bake_preface/main.rb +11 -0
  79. data/lib/kitchen/directions/bake_preface/v1.rb +18 -0
  80. data/lib/kitchen/directions/bake_references/main.rb +16 -0
  81. data/lib/kitchen/directions/bake_references/v1.rb +48 -0
  82. data/lib/kitchen/directions/bake_stepwise.rb +8 -12
  83. data/lib/kitchen/directions/bake_suggested_reading.rb +31 -0
  84. data/lib/kitchen/directions/bake_theorem/main.rb +11 -0
  85. data/lib/kitchen/directions/bake_theorem/v1.rb +28 -0
  86. data/lib/kitchen/directions/bake_toc.rb +49 -22
  87. data/lib/kitchen/directions/bake_unit_title/main.rb +11 -0
  88. data/lib/kitchen/directions/bake_unit_title/v1.rb +23 -0
  89. data/lib/kitchen/directions/bake_unnumbered_tables.rb +7 -5
  90. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +9 -0
  91. data/lib/kitchen/directions/book_answer_key_container/main.rb +11 -0
  92. data/lib/kitchen/directions/book_answer_key_container/v1.rb +13 -0
  93. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +9 -0
  94. data/lib/kitchen/directions/chapter_review_container/main.rb +11 -0
  95. data/lib/kitchen/directions/chapter_review_container/v1.rb +13 -0
  96. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +20 -0
  97. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +27 -0
  98. data/lib/kitchen/directions/move_exercises_to_eoc/v1.rb +36 -0
  99. data/lib/kitchen/directions/move_exercises_to_eoc/v2.rb +49 -0
  100. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +14 -0
  101. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +19 -0
  102. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +41 -0
  103. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +63 -0
  104. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +34 -0
  105. data/lib/kitchen/directions/move_title_text_into_span.rb +2 -2
  106. data/lib/kitchen/document.rb +83 -13
  107. data/lib/kitchen/element.rb +20 -3
  108. data/lib/kitchen/element_base.rb +373 -63
  109. data/lib/kitchen/element_enumerator.rb +8 -0
  110. data/lib/kitchen/element_enumerator_base.rb +297 -28
  111. data/lib/kitchen/element_enumerator_factory.rb +64 -53
  112. data/lib/kitchen/element_factory.rb +27 -12
  113. data/lib/kitchen/errors.rb +5 -0
  114. data/lib/kitchen/example_element.rb +21 -6
  115. data/lib/kitchen/example_element_enumerator.rb +9 -1
  116. data/lib/kitchen/exercise_element.rb +42 -0
  117. data/lib/kitchen/exercise_element_enumerator.rb +21 -0
  118. data/lib/kitchen/figure_element.rb +36 -5
  119. data/lib/kitchen/figure_element_enumerator.rb +9 -1
  120. data/lib/kitchen/metadata_element.rb +34 -0
  121. data/lib/kitchen/metadata_element_enumerator.rb +21 -0
  122. data/lib/kitchen/mixins/block_error_if.rb +24 -4
  123. data/lib/kitchen/note_element.rb +48 -20
  124. data/lib/kitchen/note_element_enumerator.rb +9 -1
  125. data/lib/kitchen/oven.rb +66 -15
  126. data/lib/kitchen/page_element.rb +84 -14
  127. data/lib/kitchen/page_element_enumerator.rb +9 -1
  128. data/lib/kitchen/pantry.rb +28 -1
  129. data/lib/kitchen/patches/nokogiri.rb +59 -2
  130. data/lib/kitchen/patches/renderable.rb +9 -3
  131. data/lib/kitchen/patches/string.rb +8 -0
  132. data/lib/kitchen/recipe.rb +69 -32
  133. data/lib/kitchen/reference_element.rb +27 -0
  134. data/lib/kitchen/references_element_enumerator.rb +20 -0
  135. data/lib/kitchen/search_history.rb +43 -4
  136. data/lib/kitchen/search_query.rb +106 -0
  137. data/lib/kitchen/selector.rb +24 -0
  138. data/lib/kitchen/selectors/base.rb +65 -0
  139. data/lib/kitchen/selectors/standard_1.rb +21 -0
  140. data/lib/kitchen/table_element.rb +55 -7
  141. data/lib/kitchen/table_element_enumerator.rb +9 -1
  142. data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
  143. data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
  144. data/lib/kitchen/term_element.rb +15 -4
  145. data/lib/kitchen/term_element_enumerator.rb +9 -1
  146. data/lib/kitchen/transliterations.rb +7 -5
  147. data/lib/kitchen/type_casting_element_enumerator.rb +17 -1
  148. data/lib/kitchen/unit_element.rb +45 -0
  149. data/lib/kitchen/unit_element_enumerator.rb +20 -0
  150. data/lib/kitchen/utils.rb +10 -13
  151. data/lib/kitchen/version.rb +5 -1
  152. data/lib/locales/en.yml +18 -7
  153. data/lib/locales/pl.yml +24 -0
  154. data/lib/openstax_kitchen.rb +44 -42
  155. data/openstax_kitchen.gemspec +26 -20
  156. data/tutorials/00/solution1.rb +9 -0
  157. data/tutorials/00/solution2.rb +8 -0
  158. data/tutorials/01/solution1.rb +18 -0
  159. data/tutorials/01/solution2.rb +26 -0
  160. data/tutorials/02/solution1.rb +31 -0
  161. data/tutorials/03/{solution_1.rb → solution1.rb} +6 -4
  162. data/tutorials/03/solution2.rb +18 -0
  163. data/tutorials/04/{solution_1.rb → solution1.rb} +4 -2
  164. data/tutorials/04/{solution_2.rb → solution2.rb} +6 -4
  165. data/tutorials/05/solution1.rb +11 -0
  166. data/tutorials/check_it +16 -15
  167. data/tutorials/setup_my_recipes +7 -6
  168. metadata +149 -24
  169. data/Dockerfile +0 -19
  170. data/docker-compose.yml +0 -12
  171. data/docker/entrypoint +0 -9
  172. data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -34
  173. data/lib/kitchen/directions/bake_exercises.rb +0 -164
  174. data/lib/kitchen/directions/bake_notes.rb +0 -58
  175. data/tutorials/00/solution_1.rb +0 -7
  176. data/tutorials/00/solution_2.rb +0 -6
  177. data/tutorials/01/solution_1.rb +0 -16
  178. data/tutorials/01/solution_2.rb +0 -24
  179. data/tutorials/02/solution_1.rb +0 -29
  180. data/tutorials/03/solution_2.rb +0 -15
  181. data/tutorials/05/solution_1.rb +0 -9
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 4.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: 2020-12-18 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nokogiri
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rainbow
28
+ name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: activesupport
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: i18n
56
+ name: rainbow
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: yard
84
+ name: inch
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -122,6 +122,62 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
125
181
  description: OpenStax content baking library
126
182
  email:
127
183
  - jpslav@gmail.com
@@ -130,13 +186,15 @@ extensions: []
130
186
  extra_rdoc_files: []
131
187
  files:
132
188
  - ".devcontainer/devcontainer.json"
189
+ - ".github/config.yml"
133
190
  - ".github/workflows/tests.yml"
134
191
  - ".gitignore"
192
+ - ".inch.yml"
135
193
  - ".rspec"
194
+ - ".rubocop.yml"
136
195
  - ".solargraph.yml"
137
196
  - CHANGELOG.md
138
197
  - CODE_OF_CONDUCT.md
139
- - Dockerfile
140
198
  - Gemfile
141
199
  - Gemfile.lock
142
200
  - LICENSE.txt
@@ -145,9 +203,14 @@ files:
145
203
  - bin/console
146
204
  - bin/setup
147
205
  - codecov.yaml
148
- - docker-compose.yml
206
+ - docker/Dockerfile
207
+ - docker/Dockerfile.ci
149
208
  - docker/bash
150
- - docker/entrypoint
209
+ - docker/build
210
+ - docker/ci
211
+ - docker/run
212
+ - docker/tag_and_push_latest
213
+ - lefthook.yml
151
214
  - lib/kitchen/ancestor.rb
152
215
  - lib/kitchen/book_document.rb
153
216
  - lib/kitchen/book_element.rb
@@ -162,27 +225,76 @@ files:
162
225
  - lib/kitchen/config.rb
163
226
  - lib/kitchen/counter.rb
164
227
  - lib/kitchen/debug/print_recipe_error.rb
228
+ - lib/kitchen/directions/.rubocop.yml
165
229
  - lib/kitchen/directions/bake_appendix.rb
166
- - lib/kitchen/directions/bake_chapter_glossary.rb
230
+ - lib/kitchen/directions/bake_chapter_glossary/main.rb
231
+ - lib/kitchen/directions/bake_chapter_glossary/v1.rb
167
232
  - lib/kitchen/directions/bake_chapter_introductions.rb
233
+ - lib/kitchen/directions/bake_chapter_key_concepts/main.rb
234
+ - lib/kitchen/directions/bake_chapter_key_concepts/v1.rb
168
235
  - lib/kitchen/directions/bake_chapter_key_equations.rb
236
+ - lib/kitchen/directions/bake_chapter_references/main.rb
237
+ - lib/kitchen/directions/bake_chapter_references/v1.rb
238
+ - lib/kitchen/directions/bake_chapter_section_exercises/main.rb
239
+ - lib/kitchen/directions/bake_chapter_section_exercises/v1.rb
169
240
  - lib/kitchen/directions/bake_chapter_summary.rb
241
+ - lib/kitchen/directions/bake_chapter_title/main.rb
242
+ - lib/kitchen/directions/bake_chapter_title/v1.rb
243
+ - lib/kitchen/directions/bake_checkpoint.rb
244
+ - lib/kitchen/directions/bake_composite_chapters.rb
170
245
  - lib/kitchen/directions/bake_composite_pages.rb
246
+ - lib/kitchen/directions/bake_equations.rb
171
247
  - lib/kitchen/directions/bake_example.rb
172
- - lib/kitchen/directions/bake_exercises.rb
173
248
  - lib/kitchen/directions/bake_figure.rb
249
+ - lib/kitchen/directions/bake_first_elements.rb
174
250
  - lib/kitchen/directions/bake_footnotes/main.rb
175
251
  - lib/kitchen/directions/bake_footnotes/v1.rb
252
+ - lib/kitchen/directions/bake_free_response/free_response.xhtml.erb
253
+ - lib/kitchen/directions/bake_free_response/main.rb
254
+ - lib/kitchen/directions/bake_free_response/v1.rb
255
+ - lib/kitchen/directions/bake_further_research.rb
176
256
  - lib/kitchen/directions/bake_index/main.rb
177
257
  - lib/kitchen/directions/bake_index/v1.rb
178
258
  - lib/kitchen/directions/bake_index/v1.xhtml.erb
259
+ - lib/kitchen/directions/bake_link_placeholders.rb
179
260
  - lib/kitchen/directions/bake_math_in_paragraph.rb
180
- - lib/kitchen/directions/bake_notes.rb
261
+ - lib/kitchen/directions/bake_non_introduction_pages.rb
262
+ - lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
263
+ - lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
264
+ - lib/kitchen/directions/bake_notes/bake_numbered_notes.rb
265
+ - lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb
266
+ - lib/kitchen/directions/bake_numbered_exercise/main.rb
267
+ - lib/kitchen/directions/bake_numbered_exercise/v1.rb
181
268
  - lib/kitchen/directions/bake_numbered_table/main.rb
182
269
  - lib/kitchen/directions/bake_numbered_table/v1.rb
270
+ - lib/kitchen/directions/bake_page_abstracts.rb
271
+ - lib/kitchen/directions/bake_preface/main.rb
272
+ - lib/kitchen/directions/bake_preface/v1.rb
273
+ - lib/kitchen/directions/bake_references/main.rb
274
+ - lib/kitchen/directions/bake_references/v1.rb
183
275
  - lib/kitchen/directions/bake_stepwise.rb
276
+ - lib/kitchen/directions/bake_suggested_reading.rb
277
+ - lib/kitchen/directions/bake_theorem/main.rb
278
+ - lib/kitchen/directions/bake_theorem/v1.rb
184
279
  - lib/kitchen/directions/bake_toc.rb
280
+ - lib/kitchen/directions/bake_unit_title/main.rb
281
+ - lib/kitchen/directions/bake_unit_title/v1.rb
185
282
  - lib/kitchen/directions/bake_unnumbered_tables.rb
283
+ - lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb
284
+ - lib/kitchen/directions/book_answer_key_container/main.rb
285
+ - lib/kitchen/directions/book_answer_key_container/v1.rb
286
+ - lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb
287
+ - lib/kitchen/directions/chapter_review_container/main.rb
288
+ - lib/kitchen/directions/chapter_review_container/v1.rb
289
+ - lib/kitchen/directions/eoc_section_title_link_snippet.rb
290
+ - lib/kitchen/directions/move_exercises_to_eoc/main.rb
291
+ - lib/kitchen/directions/move_exercises_to_eoc/v1.rb
292
+ - lib/kitchen/directions/move_exercises_to_eoc/v2.rb
293
+ - lib/kitchen/directions/move_solutions_to_answer_key/main.rb
294
+ - lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb
295
+ - lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb
296
+ - lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb
297
+ - lib/kitchen/directions/move_solutions_to_answer_key/v1.rb
186
298
  - lib/kitchen/directions/move_title_text_into_span.rb
187
299
  - lib/kitchen/document.rb
188
300
  - lib/kitchen/element.rb
@@ -194,8 +306,12 @@ files:
194
306
  - lib/kitchen/errors.rb
195
307
  - lib/kitchen/example_element.rb
196
308
  - lib/kitchen/example_element_enumerator.rb
309
+ - lib/kitchen/exercise_element.rb
310
+ - lib/kitchen/exercise_element_enumerator.rb
197
311
  - lib/kitchen/figure_element.rb
198
312
  - lib/kitchen/figure_element_enumerator.rb
313
+ - lib/kitchen/metadata_element.rb
314
+ - lib/kitchen/metadata_element_enumerator.rb
199
315
  - lib/kitchen/mixins/block_error_if.rb
200
316
  - lib/kitchen/note_element.rb
201
317
  - lib/kitchen/note_element_enumerator.rb
@@ -207,43 +323,52 @@ files:
207
323
  - lib/kitchen/patches/renderable.rb
208
324
  - lib/kitchen/patches/string.rb
209
325
  - lib/kitchen/recipe.rb
326
+ - lib/kitchen/reference_element.rb
327
+ - lib/kitchen/references_element_enumerator.rb
210
328
  - lib/kitchen/search_history.rb
329
+ - lib/kitchen/search_query.rb
330
+ - lib/kitchen/selector.rb
211
331
  - lib/kitchen/selectors/base.rb
212
332
  - lib/kitchen/selectors/standard_1.rb
213
333
  - lib/kitchen/table_element.rb
214
334
  - lib/kitchen/table_element_enumerator.rb
335
+ - lib/kitchen/templates/eob_section_title_template.xhtml.erb
336
+ - lib/kitchen/templates/eoc_section_title_template.xhtml.erb
215
337
  - lib/kitchen/term_element.rb
216
338
  - lib/kitchen/term_element_enumerator.rb
217
339
  - lib/kitchen/transliterations.rb
218
340
  - lib/kitchen/type_casting_element_enumerator.rb
341
+ - lib/kitchen/unit_element.rb
342
+ - lib/kitchen/unit_element_enumerator.rb
219
343
  - lib/kitchen/utils.rb
220
344
  - lib/kitchen/version.rb
221
345
  - lib/locales/en.yml
346
+ - lib/locales/pl.yml
222
347
  - lib/notes.md
223
348
  - lib/openstax_kitchen.rb
224
349
  - openstax_kitchen.gemspec
225
350
  - tutorials/00/expected_baked.html
226
351
  - tutorials/00/raw.html
227
- - tutorials/00/solution_1.rb
228
- - tutorials/00/solution_2.rb
352
+ - tutorials/00/solution1.rb
353
+ - tutorials/00/solution2.rb
229
354
  - tutorials/01/expected_baked.html
230
355
  - tutorials/01/raw.html
231
- - tutorials/01/solution_1.rb
232
- - tutorials/01/solution_2.rb
356
+ - tutorials/01/solution1.rb
357
+ - tutorials/01/solution2.rb
233
358
  - tutorials/02/expected_baked.html
234
359
  - tutorials/02/raw.html
235
- - tutorials/02/solution_1.rb
360
+ - tutorials/02/solution1.rb
236
361
  - tutorials/03/expected_baked.html
237
362
  - tutorials/03/raw.html
238
- - tutorials/03/solution_1.rb
239
- - tutorials/03/solution_2.rb
363
+ - tutorials/03/solution1.rb
364
+ - tutorials/03/solution2.rb
240
365
  - tutorials/04/expected_baked.html
241
366
  - tutorials/04/raw.html
242
- - tutorials/04/solution_1.rb
243
- - tutorials/04/solution_2.rb
367
+ - tutorials/04/solution1.rb
368
+ - tutorials/04/solution2.rb
244
369
  - tutorials/05/expected_baked.html
245
370
  - tutorials/05/raw.html
246
- - tutorials/05/solution_1.rb
371
+ - tutorials/05/solution1.rb
247
372
  - tutorials/check_it
248
373
  - tutorials/setup_my_recipes
249
374
  homepage: https://github.com/openstax/kitchen
@@ -262,7 +387,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
387
  requirements:
263
388
  - - ">="
264
389
  - !ruby/object:Gem::Version
265
- version: 2.3.0
390
+ version: 2.4.0
266
391
  required_rubygems_version: !ruby/object:Gem::Requirement
267
392
  requirements:
268
393
  - - ">="
data/Dockerfile DELETED
@@ -1,19 +0,0 @@
1
- FROM ruby:2.6-slim
2
-
3
- RUN apt-get update && \
4
- apt-get install -y --no-install-recommends \
5
- git \
6
- build-essential \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- WORKDIR /code
10
- COPY . /code/
11
-
12
- RUN gem install bundler
13
- RUN bundle install
14
-
15
- # Install other things that make development good
16
- RUN gem install solargraph
17
- RUN bundle exec yard gems
18
-
19
- ENTRYPOINT ["/code/docker/entrypoint"]
data/docker-compose.yml DELETED
@@ -1,12 +0,0 @@
1
- version: '3.7'
2
- services:
3
- app:
4
- image: "openstax/kitchen"
5
- build: .
6
- volumes:
7
- - .:/code
8
- networks:
9
- - openstax
10
- networks:
11
- openstax:
12
- name: openstax
data/docker/entrypoint DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- # uncomment this to load docker secrets into environment variables
5
- # export $(egrep -v '^#' /run/secrets/* | xargs)
6
-
7
- # exec "$@"
8
-
9
- tail -f /dev/null
@@ -1,34 +0,0 @@
1
- module Kitchen
2
- module Directions
3
- module BakeChapterGlossary
4
-
5
- def self.v1(chapter:, metadata_source:)
6
- metadata_elements = metadata_source.search(%w(.authors .publishers .print-style
7
- .permissions [data-type='subject'])).copy
8
-
9
- definitions = chapter.glossaries.search("dl").cut
10
- definitions.sort_by! do |definition|
11
- [definition.first("dt").text.downcase, definition.first("dd").text.downcase]
12
- end
13
-
14
- chapter.glossaries.trash
15
-
16
- chapter.append(child:
17
- <<~HTML
18
- <div class="os-eoc os-glossary-container" data-type="composite-page" data-uuid-key="glossary">
19
- <h2 data-type="document-title">
20
- <span class="os-text">#{I18n.t(:eoc_key_terms_title)}</span>
21
- </h2>
22
- <div data-type="metadata" style="display: none;">
23
- <h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_key_terms_title)}</h1>
24
- #{metadata_elements.paste}
25
- </div>
26
- #{definitions.paste}
27
- </div>
28
- HTML
29
- ) unless definitions.none?
30
- end
31
-
32
- end
33
- end
34
- end
@@ -1,164 +0,0 @@
1
- module Kitchen
2
- module Directions
3
- module BakeExercises
4
-
5
- def self.v1(book:)
6
- metadata_elements = book.metadata.search(%w(.authors .publishers .print-style
7
- .permissions [data-type='subject'])).copy
8
-
9
- solutions_clipboards = []
10
-
11
- book.chapters.each do |chapter|
12
- exercise_clipboard = Clipboard.new
13
- solution_clipboard = Clipboard.new
14
- solutions_clipboards.push(solution_clipboard)
15
-
16
- chapter.pages("$:not(.introduction)").each do |page|
17
- exercise_section = page.exercises
18
- exercise_section.first("[data-type='title']")&.trash
19
- exercise_section_title = page.title.copy
20
- exercise_section_title.name = "h3"
21
- exercise_section_title.replace_children(with: <<~HTML
22
- <span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter)}</span>
23
- <span class="os-divider"> </span>
24
- <span class="os-text" data-type="" itemprop="">#{exercise_section_title.children}</span>
25
- HTML
26
- )
27
-
28
- exercise_section.prepend(child:
29
- <<~HTML
30
- <a href="##{page.title.id}">
31
- #{exercise_section_title.paste}
32
- </a>
33
- HTML
34
- )
35
-
36
- exercise_section.search("[data-type='exercise']").each do |exercise|
37
- exercise.document.pantry(name: :link_text).store(
38
- "#{I18n.t(:exercise_label)} #{chapter.count_in(:book)}.#{exercise.count_in(:chapter)}",
39
- label: exercise.id
40
- )
41
-
42
- bake_exercise_in_place(exercise: exercise)
43
- exercise.first("[data-type='solution']")&.cut(to: solution_clipboard)
44
- end
45
-
46
- exercise_section.cut(to: exercise_clipboard)
47
- end
48
-
49
- chapter.append(child:
50
- <<~HTML
51
- <div class="os-eoc os-exercises-container" data-type="composite-page" data-uuid-key=".exercises">
52
- <h2 data-type="document-title">
53
- <span class="os-text">#{I18n.t(:eoc_exercises_title)}</span>
54
- </h2>
55
- <div data-type="metadata" style="display: none;">
56
- <h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_exercises_title)}</h1>
57
- #{metadata_elements.paste}
58
- </div>
59
- #{exercise_clipboard.paste}
60
- </div>
61
- HTML
62
- ) unless exercise_clipboard.none?
63
- end
64
-
65
- # Store a paste here to use at end so that uniquifyied IDs match legacy baking
66
- eob_metadata = metadata_elements.paste
67
-
68
- solutions = solutions_clipboards.map.with_index do |solution_clipboard, index|
69
- <<~HTML
70
- <div class="os-eob os-solution-container " data-type="composite-page" data-uuid-key=".solution#{index+1}">
71
- <h2 data-type="document-title">
72
- <span class="os-text">#{index+1}</span>
73
- </h2>
74
- <div data-type="metadata" style="display: none;">
75
- <h1 data-type="document-title" itemprop="name">#{index+1}</h1>
76
- #{metadata_elements.paste}
77
- </div>
78
- #{solution_clipboard.paste}
79
- </div>
80
- HTML
81
- end
82
-
83
- book.first("body").append(child:
84
- <<~HTML
85
- <div class="os-eob os-solution-container " data-type="composite-chapter" data-uuid-key=".solution">
86
- <h1 data-type="document-title" id="composite-chapter-1">
87
- <span class="os-text">#{I18n.t(:eoc_answer_key_title)}</span>
88
- </h1>
89
- <div data-type="metadata" style="display: none;">
90
- <h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_answer_key_title)}</h1>
91
- #{eob_metadata}
92
- </div>
93
- #{solutions.join("\n")}
94
- </div>
95
- HTML
96
- ) unless solutions.none?
97
- end
98
-
99
- def self.bake_exercise_in_place(exercise:)
100
- # Bake an exercise in place going from:
101
- #
102
- # <div data-type="exercise" id="exerciseId">
103
- # <div data-type="problem" id="problemId">
104
- # Problem Content
105
- # </div>
106
- # <div data-type="solution" id="solutionId">
107
- # Solution Content
108
- # </div>
109
- # </div>
110
- #
111
- # to
112
- #
113
- # <div data-type="exercise" id="exerciseId" class="os-hasSolution">
114
- # <div data-type="problem" id="problemId">
115
- # <a class="os-number" href="#exerciseId-solution">1</a>
116
- # <span class="os-divider">. </span>
117
- # <div class="os-problem-container ">
118
- # Problem Content
119
- # </div>
120
- # </div>
121
- # <div data-type="solution" id="exerciseId-solution">
122
- # <a class="os-number" href="#exerciseId">1</a>
123
- # <span class="os-divider">. </span>
124
- # <div class="os-solution-container ">
125
- # Solution Content
126
- # </div>
127
- # </div>
128
- # </div>
129
- #
130
- # If there is no solution, don't add the 'os-hasSolution' class and don't
131
- # link the number.
132
-
133
- problem = exercise.first("[data-type='problem']")
134
- solution = exercise.first("[data-type='solution']")
135
-
136
- problem_number = "<span class='os-number'>#{exercise.count_in(:chapter)}</span>"
137
-
138
- if solution.present?
139
- solution.id = "#{exercise.id}-solution"
140
-
141
- exercise.add_class("os-hasSolution")
142
- problem_number = "<a href='##{solution.id}' class='os-number' >#{exercise.count_in(:chapter)}</a>"
143
-
144
- solution.replace_children(with:
145
- <<~HTML
146
- <a class="os-number" href="##{exercise.id}">#{exercise.count_in(:chapter)}</a>
147
- <span class="os-divider">. </span>
148
- <div class="os-solution-container ">#{solution.children}</div>
149
- HTML
150
- )
151
- end
152
-
153
- problem.replace_children(with:
154
- <<~HTML
155
- #{problem_number}
156
- <span class="os-divider">. </span>
157
- <div class="os-problem-container ">#{problem.children}</div>
158
- HTML
159
- )
160
- end
161
-
162
- end
163
- end
164
- end