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
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BakeReferences
|
4
|
+
class V1
|
5
|
+
renderable
|
6
|
+
|
7
|
+
def bake(book:, metadata_source:)
|
8
|
+
@metadata = metadata_source.children_to_keep.copy
|
9
|
+
@klass = 'reference'
|
10
|
+
@uuid_prefix = '.'
|
11
|
+
@title = I18n.t(:references)
|
12
|
+
|
13
|
+
book.chapters.each do |chapter|
|
14
|
+
chapter.search('[data-type="cite"]').each do |link|
|
15
|
+
link.prepend(child:
|
16
|
+
<<~HTML
|
17
|
+
<sup class="os-citation-number">#{link.count_in(:chapter)}</sup>
|
18
|
+
HTML
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
chapter.references.each do |reference|
|
23
|
+
reference.prepend(child:
|
24
|
+
<<~HTML.chomp
|
25
|
+
<span class="os-reference-number">#{reference.count_in(:chapter)}. </span>
|
26
|
+
HTML
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
chapter_references = chapter.pages.references.cut
|
31
|
+
chapter_title_no_num = chapter.title.search('.os-text')
|
32
|
+
|
33
|
+
chapter.append(child:
|
34
|
+
<<~HTML
|
35
|
+
<div class="os-chapter-area">
|
36
|
+
<h2 data-type="document-title">#{chapter_title_no_num}</h2>
|
37
|
+
#{chapter_references.paste}
|
38
|
+
</div>
|
39
|
+
HTML
|
40
|
+
)
|
41
|
+
end
|
42
|
+
chapter_area_references = book.chapters.search('.os-chapter-area').cut
|
43
|
+
@content = chapter_area_references.paste
|
44
|
+
book.body.append(child: render(file:
|
45
|
+
'../../templates/eob_section_title_template.xhtml.erb'))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,27 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kitchen
|
2
4
|
module Directions
|
3
5
|
module BakeStepwise
|
4
|
-
|
5
6
|
def self.v1(book:)
|
6
|
-
book.search(
|
7
|
-
ol.remove_class(
|
8
|
-
ol.add_class(
|
7
|
+
book.search('ol.stepwise').each do |ol|
|
8
|
+
ol.remove_class('stepwise')
|
9
|
+
ol.add_class('os-stepwise')
|
9
10
|
|
10
|
-
ol.search(
|
11
|
-
li.
|
12
|
-
<<~HTML
|
13
|
-
<span class="os-stepwise-content">#{li.children}</span>
|
14
|
-
HTML
|
15
|
-
)
|
11
|
+
ol.search('li').each_with_index do |li, ii|
|
12
|
+
li.wrap_children('span', class: 'os-stepwise-content')
|
16
13
|
li.prepend(child:
|
17
14
|
<<~HTML
|
18
|
-
<span class="os-stepwise-token">#{I18n.t(:stepwise_step_label)} #{ii+1}. </span>
|
15
|
+
<span class="os-stepwise-token">#{I18n.t(:stepwise_step_label)} #{ii + 1}. </span>
|
19
16
|
HTML
|
20
17
|
)
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
24
|
-
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
# Bake directions for EOC suggested reading
|
6
|
+
#
|
7
|
+
module BakeSuggestedReading
|
8
|
+
def self.v1(book:)
|
9
|
+
metadata_elements = book.metadata.children_to_keep.copy
|
10
|
+
book.chapters.each do |chapter|
|
11
|
+
suggested_reading = chapter.search('section.suggested-reading').cut
|
12
|
+
|
13
|
+
chapter.append(child:
|
14
|
+
<<~HTML
|
15
|
+
<div class="os-eoc os-suggested-reading-container" data-type="composite-page" data-uuid-key=".suggested-reading">
|
16
|
+
<h2 data-type="document-title">
|
17
|
+
<span class="os-text">#{I18n.t(:eoc_suggested_reading)}</span>
|
18
|
+
</h2>
|
19
|
+
<div data-type="metadata" style="display: none;">
|
20
|
+
<h1 data-type="document-title" itemprop="name">#{I18n.t(:eoc_suggested_reading)}</h1>
|
21
|
+
#{metadata_elements.paste}
|
22
|
+
</div>
|
23
|
+
#{suggested_reading.paste}
|
24
|
+
</div>
|
25
|
+
HTML
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BakeTheorem
|
4
|
+
class V1
|
5
|
+
def bake(theorem:, number:)
|
6
|
+
theorem['use-subtitle'] = true
|
7
|
+
new_subtitle = theorem.title.cut
|
8
|
+
|
9
|
+
theorem.wrap_children(class: 'os-note-body')
|
10
|
+
note_body = theorem.first('.os-note-body')
|
11
|
+
|
12
|
+
note_body.prepend(sibling:
|
13
|
+
<<~HTML
|
14
|
+
<div class="os-title">
|
15
|
+
<span class="os-title-label">#{I18n.t(:theorem)} </span>
|
16
|
+
<span class="os-number">#{number}</span>
|
17
|
+
<span class="os-divider"> </span>
|
18
|
+
</div>
|
19
|
+
HTML
|
20
|
+
)
|
21
|
+
|
22
|
+
new_subtitle.name = 'h4'
|
23
|
+
new_subtitle.add_class('os-subtitle')
|
24
|
+
new_subtitle.children.wrap('<span class="os-subtitle-label">')
|
25
|
+
note_body.prepend(child: new_subtitle.paste)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,10 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kitchen
|
2
4
|
module Directions
|
3
5
|
module BakeToc
|
4
|
-
|
5
6
|
def self.v1(book:)
|
6
7
|
li_tags = book.body.element_children.map do |element|
|
7
8
|
case element
|
9
|
+
when UnitElement
|
10
|
+
li_for_unit(element)
|
8
11
|
when ChapterElement
|
9
12
|
li_for_chapter(element)
|
10
13
|
when PageElement, CompositePageElement
|
@@ -14,25 +17,41 @@ module Kitchen
|
|
14
17
|
end
|
15
18
|
end.compact.join("\n")
|
16
19
|
|
17
|
-
book.first!(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
book.first!('nav').replace_children(with: <<~HTML
|
21
|
+
<h1 class="os-toc-title">#{I18n.t(:toc_title)}</h1>
|
22
|
+
<ol>
|
23
|
+
#{li_tags}
|
24
|
+
</ol>
|
25
|
+
HTML
|
23
26
|
)
|
24
27
|
end
|
25
28
|
|
29
|
+
def self.li_for_unit(unit)
|
30
|
+
chapters = unit.element_children.only(ChapterElement)
|
31
|
+
<<~HTML
|
32
|
+
<li cnx-archive-uri="" cnx-archive-shortid="" class="os-toc-unit">
|
33
|
+
<a href="#">
|
34
|
+
<span class="os-number"><span class="os-part-text">#{I18n.t(:unit)} </span>#{unit.count_in(:book)}</span>
|
35
|
+
<span class="os-divider"> </span>
|
36
|
+
<span data-type itemprop class="os-text">#{unit.title_text}</span>
|
37
|
+
</a>
|
38
|
+
<ol class="os-unit">
|
39
|
+
#{chapters.map { |chapter| li_for_chapter(chapter) }.join("\n")}
|
40
|
+
</ol>
|
41
|
+
</li>
|
42
|
+
HTML
|
43
|
+
end
|
44
|
+
|
26
45
|
def self.li_for_composite_chapter(chapter)
|
27
46
|
pages = chapter.element_children.only(CompositePageElement)
|
28
47
|
|
29
48
|
<<~HTML
|
30
49
|
<li class="os-toc-composite-chapter" cnx-archive-shortid="" cnx-archive-uri="">
|
31
50
|
<a href="##{chapter.title.id}">
|
32
|
-
#{chapter.title.children
|
51
|
+
#{chapter.title.children}
|
33
52
|
</a>
|
34
53
|
<ol class="os-chapter">
|
35
|
-
#{pages.map{|page| li_for_page(page)}.join("\n")}
|
54
|
+
#{pages.map { |page| li_for_page(page) }.join("\n")}
|
36
55
|
</ol>
|
37
56
|
</li>
|
38
57
|
HTML
|
@@ -40,16 +59,22 @@ module Kitchen
|
|
40
59
|
|
41
60
|
def self.li_for_chapter(chapter)
|
42
61
|
pages = chapter.element_children.only(PageElement, CompositePageElement)
|
62
|
+
inner_composite_chapters = chapter.element_children.only(CompositeChapterElement)
|
43
63
|
|
44
64
|
<<~HTML
|
45
65
|
<li class="os-toc-chapter" cnx-archive-shortid="" cnx-archive-uri="">
|
46
66
|
<a href="##{chapter.title.id}">
|
47
|
-
<span class="os-number"><span class="os-part-text"
|
67
|
+
<span class="os-number"><span class="os-part-text">#{I18n.t(:chapter)} </span>#{chapter.count_in(:book)}</span>
|
48
68
|
<span class="os-divider"> </span>
|
49
|
-
<span class="os-text" data-type="" itemprop="">#{chapter.title.first!(
|
69
|
+
<span class="os-text" data-type="" itemprop="">#{chapter.title.first!('.os-text').text}</span>
|
50
70
|
</a>
|
51
71
|
<ol class="os-chapter">
|
52
|
-
#{pages.map{|page| li_for_page(page)}.join("\n")}
|
72
|
+
#{pages.map { |page| li_for_page(page) }.join("\n")}
|
73
|
+
#{
|
74
|
+
inner_composite_chapters.map do |composite_chapter|
|
75
|
+
li_for_composite_chapter(composite_chapter)
|
76
|
+
end.join("\n")
|
77
|
+
}
|
53
78
|
</ol>
|
54
79
|
</li>
|
55
80
|
HTML
|
@@ -57,21 +82,24 @@ module Kitchen
|
|
57
82
|
|
58
83
|
def self.li_for_page(page)
|
59
84
|
li_class =
|
60
|
-
|
85
|
+
case page
|
86
|
+
when PageElement
|
61
87
|
if page.has_ancestor?(:chapter)
|
62
|
-
|
88
|
+
'os-toc-chapter-page'
|
63
89
|
elsif page.is_appendix?
|
64
|
-
|
90
|
+
'os-toc-appendix'
|
65
91
|
elsif page.is_preface?
|
66
|
-
|
92
|
+
'os-toc-preface'
|
67
93
|
else
|
68
94
|
raise "do not know what TOC class to use for page with classes #{page.classes}"
|
69
95
|
end
|
70
|
-
|
96
|
+
when CompositePageElement
|
71
97
|
if page.is_index?
|
72
|
-
|
98
|
+
'os-toc-index'
|
99
|
+
elsif page.is_reference?
|
100
|
+
'os-toc-reference'
|
73
101
|
elsif page.has_ancestor?(:composite_chapter) || page.has_ancestor?(:chapter)
|
74
|
-
|
102
|
+
'os-toc-chapter-composite-page'
|
75
103
|
else
|
76
104
|
raise "do not know what TOC class to use for page with classes #{page.classes}"
|
77
105
|
end
|
@@ -82,8 +110,8 @@ module Kitchen
|
|
82
110
|
title = page.title.copy
|
83
111
|
|
84
112
|
# The part text gets inserted as a child to the number span
|
85
|
-
part_text = title.first(
|
86
|
-
number = title.first(
|
113
|
+
part_text = title.first('.os-part-text')
|
114
|
+
number = title.first('.os-number')
|
87
115
|
if part_text && number
|
88
116
|
part_text = part_text.cut
|
89
117
|
number.prepend(child: part_text.paste)
|
@@ -97,7 +125,6 @@ module Kitchen
|
|
97
125
|
</li>
|
98
126
|
HTML
|
99
127
|
end
|
100
|
-
|
101
128
|
end
|
102
129
|
end
|
103
130
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BakeUnitTitle
|
4
|
+
class V1
|
5
|
+
def bake(book:)
|
6
|
+
book.units.each do |unit|
|
7
|
+
compose_unit_title(unit: unit)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def compose_unit_title(unit:)
|
12
|
+
heading = unit.title
|
13
|
+
heading.replace_children(with:
|
14
|
+
<<~HTML
|
15
|
+
<span class="os-part-text">#{I18n.t(:unit)} </span>
|
16
|
+
<span class="os-number">#{unit.count_in(:book)}</span>
|
17
|
+
<span class="os-divider"> </span>
|
18
|
+
<span data-type="" itemprop="" class="os-text">#{heading.text}</span>
|
19
|
+
HTML
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kitchen
|
2
4
|
module Directions
|
3
5
|
module BakeUnnumberedTables
|
4
|
-
|
5
6
|
def self.v1(book:)
|
6
|
-
book.tables(
|
7
|
-
table.wrap(%
|
8
|
-
table.remove_attribute(
|
7
|
+
book.tables('$.unnumbered').each do |table|
|
8
|
+
table.wrap(%(<div class="os-table">))
|
9
|
+
table.remove_attribute('summary')
|
10
|
+
table.parent.add_class('os-unstyled-container') if table.unstyled?
|
11
|
+
table.parent.add_class('os-column-header-container') if table.column_header?
|
9
12
|
end
|
10
13
|
end
|
11
|
-
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -0,0 +1,9 @@
|
|
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>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BookAnswerKeyContainer
|
4
|
+
class V1
|
5
|
+
renderable
|
6
|
+
|
7
|
+
def bake(book:)
|
8
|
+
@metadata = book.metadata.children_to_keep.copy
|
9
|
+
book.body.append(child: render(file: 'eob_solutions_container.xhtml.erb'))
|
10
|
+
book.body.first('.os-eob.os-solutions-container')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="os-eoc os-chapter-review-container" data-type="composite-chapter" data-uuid-key=".chapter-review">
|
2
|
+
<h2 data-type="document-title">
|
3
|
+
<span class="os-text"><%= I18n.t(:eoc_chapter_review) %></span>
|
4
|
+
</h2>
|
5
|
+
<div data-type="metadata" style="display: none;">
|
6
|
+
<h1 data-type="document-title" itemprop="name"><%= I18n.t(:eoc_chapter_review) %></h1>
|
7
|
+
<%= @metadata.paste %>
|
8
|
+
</div>
|
9
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::ChapterReviewContainer
|
4
|
+
class V1
|
5
|
+
renderable
|
6
|
+
|
7
|
+
def bake(chapter:, metadata_source:)
|
8
|
+
@metadata = metadata_source.children_to_keep.copy
|
9
|
+
chapter.append(child: render(file: 'chapter_review.xhtml.erb'))
|
10
|
+
chapter.first('.os-eoc.os-chapter-review-container')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
module EocSectionTitleLinkSnippet
|
6
|
+
def self.v1(page:)
|
7
|
+
chapter = page.ancestor(:chapter)
|
8
|
+
<<~HTML
|
9
|
+
<a href="##{page.title.id}">
|
10
|
+
<h3 data-type="document-title" id="#{page.title.copied_id}">
|
11
|
+
<span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter)}</span>
|
12
|
+
<span class="os-divider"> </span>
|
13
|
+
<span class="os-text" data-type="" itemprop="">#{page.title_text}</span>
|
14
|
+
</h3>
|
15
|
+
</a>
|
16
|
+
HTML
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|