openstax_kitchen 1.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +37 -17
- data/.github/config.yml +14 -0
- data/.github/workflows/tests.yml +5 -15
- data/.gitignore +2 -2
- data/.inch.yml +6 -0
- data/.rubocop.yml +65 -0
- data/CHANGELOG.md +85 -2
- data/Gemfile +5 -3
- data/Gemfile.lock +66 -18
- data/README.md +69 -15
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/docker/Dockerfile +36 -0
- data/docker/Dockerfile.ci +10 -0
- data/docker/bash +5 -1
- data/docker/build +10 -0
- data/docker/ci +15 -0
- data/docker/run +9 -0
- data/docker/tag_and_push_latest +17 -0
- data/lefthook.yml +6 -0
- data/lib/kitchen/ancestor.rb +38 -1
- data/lib/kitchen/book_document.rb +20 -2
- data/lib/kitchen/book_element.rb +40 -5
- data/lib/kitchen/book_element_enumerator.rb +4 -0
- data/lib/kitchen/book_recipe.rb +15 -1
- data/lib/kitchen/chapter_element.rb +43 -6
- data/lib/kitchen/chapter_element_enumerator.rb +9 -1
- data/lib/kitchen/clipboard.rb +35 -4
- data/lib/kitchen/composite_chapter_element.rb +21 -6
- data/lib/kitchen/composite_page_element.rb +35 -7
- data/lib/kitchen/composite_page_element_enumerator.rb +9 -1
- data/lib/kitchen/config.rb +20 -6
- data/lib/kitchen/counter.rb +9 -2
- data/lib/kitchen/debug/print_recipe_error.rb +53 -35
- data/lib/kitchen/directions/.rubocop.yml +22 -0
- data/lib/kitchen/directions/bake_appendix.rb +4 -4
- data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
- data/lib/kitchen/directions/bake_chapter_introductions.rb +7 -7
- data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +16 -0
- data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +35 -0
- data/lib/kitchen/directions/bake_chapter_key_equations.rb +30 -20
- data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +11 -0
- data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +28 -0
- data/lib/kitchen/directions/bake_chapter_summary.rb +45 -36
- data/lib/kitchen/directions/bake_chapter_title/main.rb +11 -0
- data/lib/kitchen/directions/bake_chapter_title/v1.rb +24 -0
- data/lib/kitchen/directions/bake_checkpoint.rb +44 -0
- data/lib/kitchen/directions/bake_composite_chapters.rb +14 -0
- data/lib/kitchen/directions/bake_composite_pages.rb +2 -2
- data/lib/kitchen/directions/bake_equations.rb +37 -0
- data/lib/kitchen/directions/bake_example.rb +39 -11
- data/lib/kitchen/directions/bake_figure.rb +8 -5
- data/lib/kitchen/directions/bake_first_elements.rb +16 -0
- data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
- data/lib/kitchen/directions/bake_footnotes/v1.rb +6 -5
- data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
- data/lib/kitchen/directions/bake_free_response/main.rb +11 -0
- data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
- data/lib/kitchen/directions/bake_further_research.rb +59 -0
- data/lib/kitchen/directions/bake_index/main.rb +2 -2
- data/lib/kitchen/directions/bake_index/v1.rb +46 -18
- data/lib/kitchen/directions/bake_link_placeholders.rb +24 -0
- data/lib/kitchen/directions/bake_math_in_paragraph.rb +5 -3
- data/lib/kitchen/directions/bake_non_introduction_pages.rb +26 -0
- data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +29 -0
- data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +22 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +51 -0
- data/lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb +30 -0
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +15 -0
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +47 -0
- data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -4
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +37 -18
- data/lib/kitchen/directions/bake_page_abstracts.rb +30 -0
- data/lib/kitchen/directions/bake_preface/main.rb +11 -0
- data/lib/kitchen/directions/bake_preface/v1.rb +18 -0
- data/lib/kitchen/directions/bake_references/main.rb +16 -0
- data/lib/kitchen/directions/bake_references/v1.rb +48 -0
- data/lib/kitchen/directions/bake_stepwise.rb +8 -12
- data/lib/kitchen/directions/bake_suggested_reading.rb +31 -0
- data/lib/kitchen/directions/bake_theorem/main.rb +11 -0
- data/lib/kitchen/directions/bake_theorem/v1.rb +28 -0
- data/lib/kitchen/directions/bake_toc.rb +49 -22
- data/lib/kitchen/directions/bake_unit_title/main.rb +11 -0
- data/lib/kitchen/directions/bake_unit_title/v1.rb +23 -0
- data/lib/kitchen/directions/bake_unnumbered_tables.rb +7 -5
- data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +9 -0
- data/lib/kitchen/directions/book_answer_key_container/main.rb +11 -0
- data/lib/kitchen/directions/book_answer_key_container/v1.rb +13 -0
- data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +9 -0
- data/lib/kitchen/directions/chapter_review_container/main.rb +11 -0
- data/lib/kitchen/directions/chapter_review_container/v1.rb +13 -0
- data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +20 -0
- data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +27 -0
- data/lib/kitchen/directions/move_exercises_to_eoc/v1.rb +36 -0
- data/lib/kitchen/directions/move_exercises_to_eoc/v2.rb +49 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +14 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +19 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +41 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +63 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +34 -0
- data/lib/kitchen/directions/move_title_text_into_span.rb +2 -2
- data/lib/kitchen/document.rb +83 -13
- data/lib/kitchen/element.rb +20 -3
- data/lib/kitchen/element_base.rb +373 -63
- data/lib/kitchen/element_enumerator.rb +8 -0
- data/lib/kitchen/element_enumerator_base.rb +297 -28
- data/lib/kitchen/element_enumerator_factory.rb +64 -53
- data/lib/kitchen/element_factory.rb +27 -12
- data/lib/kitchen/errors.rb +5 -0
- data/lib/kitchen/example_element.rb +21 -6
- data/lib/kitchen/example_element_enumerator.rb +9 -1
- data/lib/kitchen/exercise_element.rb +42 -0
- data/lib/kitchen/exercise_element_enumerator.rb +21 -0
- data/lib/kitchen/figure_element.rb +36 -5
- data/lib/kitchen/figure_element_enumerator.rb +9 -1
- data/lib/kitchen/metadata_element.rb +34 -0
- data/lib/kitchen/metadata_element_enumerator.rb +21 -0
- data/lib/kitchen/mixins/block_error_if.rb +24 -4
- data/lib/kitchen/note_element.rb +48 -20
- data/lib/kitchen/note_element_enumerator.rb +9 -1
- data/lib/kitchen/oven.rb +66 -15
- data/lib/kitchen/page_element.rb +84 -14
- data/lib/kitchen/page_element_enumerator.rb +9 -1
- data/lib/kitchen/pantry.rb +28 -1
- data/lib/kitchen/patches/nokogiri.rb +19 -2
- data/lib/kitchen/patches/renderable.rb +9 -3
- data/lib/kitchen/patches/string.rb +8 -0
- data/lib/kitchen/recipe.rb +69 -32
- data/lib/kitchen/reference_element.rb +27 -0
- data/lib/kitchen/references_element_enumerator.rb +20 -0
- data/lib/kitchen/search_history.rb +43 -4
- data/lib/kitchen/search_query.rb +106 -0
- data/lib/kitchen/selector.rb +24 -0
- data/lib/kitchen/selectors/base.rb +65 -0
- data/lib/kitchen/selectors/standard_1.rb +21 -0
- data/lib/kitchen/table_element.rb +55 -7
- data/lib/kitchen/table_element_enumerator.rb +9 -1
- data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/term_element.rb +15 -4
- data/lib/kitchen/term_element_enumerator.rb +9 -1
- data/lib/kitchen/transliterations.rb +7 -5
- data/lib/kitchen/type_casting_element_enumerator.rb +17 -1
- data/lib/kitchen/unit_element.rb +45 -0
- data/lib/kitchen/unit_element_enumerator.rb +20 -0
- data/lib/kitchen/utils.rb +10 -13
- data/lib/kitchen/version.rb +5 -1
- data/lib/locales/en.yml +18 -7
- data/lib/locales/pl.yml +24 -0
- data/lib/openstax_kitchen.rb +59 -0
- data/openstax_kitchen.gemspec +26 -20
- data/tutorials/00/solution1.rb +9 -0
- data/tutorials/00/solution2.rb +8 -0
- data/tutorials/01/solution1.rb +18 -0
- data/tutorials/01/solution2.rb +26 -0
- data/tutorials/02/solution1.rb +31 -0
- data/tutorials/03/{solution_1.rb → solution1.rb} +6 -4
- data/tutorials/03/solution2.rb +18 -0
- data/tutorials/04/{solution_1.rb → solution1.rb} +4 -2
- data/tutorials/04/{solution_2.rb → solution2.rb} +6 -4
- data/tutorials/05/solution1.rb +11 -0
- data/tutorials/check_it +16 -15
- data/tutorials/setup_my_recipes +7 -6
- metadata +148 -27
- data/Dockerfile +0 -19
- data/bin/normalize +0 -79
- data/books/chemistry2e/bake.rb +0 -133
- data/docker-compose.yml +0 -12
- data/docker/entrypoint +0 -9
- data/lib/kitchen.rb +0 -57
- data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -34
- data/lib/kitchen/directions/bake_exercises.rb +0 -164
- data/lib/kitchen/directions/bake_notes.rb +0 -58
- data/tutorials/00/solution_1.rb +0 -7
- data/tutorials/00/solution_2.rb +0 -6
- data/tutorials/01/solution_1.rb +0 -16
- data/tutorials/01/solution_2.rb +0 -24
- data/tutorials/02/solution_1.rb +0 -29
- data/tutorials/03/solution_2.rb +0 -15
- data/tutorials/05/solution_1.rb +0 -9
@@ -1,58 +0,0 @@
|
|
1
|
-
module Kitchen
|
2
|
-
module Directions
|
3
|
-
module BakeNotes
|
4
|
-
|
5
|
-
def self.v1(book:)
|
6
|
-
book.notes.each do |note|
|
7
|
-
title = note.title&.cut
|
8
|
-
|
9
|
-
note.replace_children(with:
|
10
|
-
<<~HTML
|
11
|
-
<div class="os-note-body">#{note.children}</div>
|
12
|
-
HTML
|
13
|
-
)
|
14
|
-
|
15
|
-
if title
|
16
|
-
if note.indicates_autogenerated_title?
|
17
|
-
note.prepend(child:
|
18
|
-
<<~HTML
|
19
|
-
<h3 class="os-title" data-type="title">
|
20
|
-
<span class="os-title-label">#{note.autogenerated_title}</span>
|
21
|
-
</h3>
|
22
|
-
HTML
|
23
|
-
)
|
24
|
-
|
25
|
-
title.name = "h4"
|
26
|
-
title.add_class("os-subtitle")
|
27
|
-
title.replace_children(with:
|
28
|
-
<<~HTML
|
29
|
-
<span class="os-subtitle-label">#{title.children}</span>
|
30
|
-
HTML
|
31
|
-
)
|
32
|
-
note.first!(".os-note-body").prepend(child: title.raw)
|
33
|
-
else
|
34
|
-
title.name = "h3"
|
35
|
-
title.add_class("os-title")
|
36
|
-
title.replace_children(with:
|
37
|
-
<<~HTML
|
38
|
-
<span data-type="" id="#{title.id}" class="os-title-label">#{title.children}</span>
|
39
|
-
HTML
|
40
|
-
)
|
41
|
-
title.remove_attribute("id")
|
42
|
-
note.prepend(child: title.raw)
|
43
|
-
end
|
44
|
-
else
|
45
|
-
note.prepend(child:
|
46
|
-
<<~HTML
|
47
|
-
<h3 class="os-title" data-type="title">
|
48
|
-
<span class="os-title-label">#{note.autogenerated_title}</span>
|
49
|
-
</h3>
|
50
|
-
HTML
|
51
|
-
)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/tutorials/00/solution_1.rb
DELETED
data/tutorials/00/solution_2.rb
DELETED
data/tutorials/01/solution_1.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
@solution_1 = Kitchen::Recipe.new do |doc|
|
2
|
-
|
3
|
-
doc.search("[data-type='chapter']").each do |chapter|
|
4
|
-
movers = chapter.search(".will-move").cut
|
5
|
-
movers.each{|mover| mover.name = "section"}
|
6
|
-
|
7
|
-
chapter.append(child: <<~HTML
|
8
|
-
<div class="eoc">
|
9
|
-
<div class="os-title">End of Chapter Collations</div>
|
10
|
-
#{movers.paste}
|
11
|
-
</div>
|
12
|
-
HTML
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
data/tutorials/01/solution_2.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
@solution_2 = Kitchen::BookRecipe.new do |doc|
|
2
|
-
|
3
|
-
# ^
|
4
|
-
# |
|
5
|
-
#
|
6
|
-
# BookRecipe gives us `doc.book` and `book.chapters` to make the code cleaner
|
7
|
-
#
|
8
|
-
# | |
|
9
|
-
# v v
|
10
|
-
|
11
|
-
doc.book.chapters.each do |chapter|
|
12
|
-
movers = chapter.search(".will-move").cut
|
13
|
-
movers.each{|mover| mover.name = "section"}
|
14
|
-
|
15
|
-
chapter.append(child: <<~HTML
|
16
|
-
<div class="eoc">
|
17
|
-
<div class="os-title">End of Chapter Collations</div>
|
18
|
-
#{movers.paste}
|
19
|
-
</div>
|
20
|
-
HTML
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/tutorials/02/solution_1.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
@solution_1 = Kitchen::Recipe.new do |doc|
|
2
|
-
|
3
|
-
doc.search("[data-type='chapter']").each do |chapter|
|
4
|
-
review_questions = chapter.search(".review-questions").cut
|
5
|
-
critical_thinking = chapter.search(".critical-thinking").cut
|
6
|
-
|
7
|
-
[review_questions, critical_thinking].each do |clipboard|
|
8
|
-
clipboard.each do |element|
|
9
|
-
element.first("h3").trash
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
chapter.append(child: <<~HTML
|
14
|
-
<div class="eoc">
|
15
|
-
<h2 data-type="document-title">End of Chapter Stuff</h2>
|
16
|
-
<div class="critical-thinking-container">
|
17
|
-
<div class="os-title">Critical Thinking Questions</div>
|
18
|
-
#{critical_thinking.paste}
|
19
|
-
</div>
|
20
|
-
<div class="review-questions-container">
|
21
|
-
<div class="os-title">Review Questions</div>
|
22
|
-
#{review_questions.paste}
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
HTML
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
data/tutorials/03/solution_2.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
@solution_2 = Kitchen::BookRecipe.new do |doc|
|
2
|
-
book = doc.book
|
3
|
-
|
4
|
-
book.chapters.each do |chapter|
|
5
|
-
chapter.prepend(child: <<~HTML
|
6
|
-
<h1 data-type="document-title">Chapter #{chapter.count_in(:book)}</h1>
|
7
|
-
HTML
|
8
|
-
)
|
9
|
-
|
10
|
-
chapter.pages.each do |page|
|
11
|
-
page.title.set(:name, "h2")
|
12
|
-
.prepend(child: "#{chapter.count_in(:book)}.#{page.count_in(:chapter)} ")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|