openstax_kitchen 12.0.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +2 -2
  5. data/lib/kitchen/directions/bake_annotation_classes/main.rb +2 -2
  6. data/lib/kitchen/directions/bake_annotation_classes/v1.rb +3 -3
  7. data/lib/kitchen/directions/bake_appendix.rb +1 -0
  8. data/lib/kitchen/directions/bake_autotitled_exercise/main.rb +4 -0
  9. data/lib/kitchen/directions/bake_autotitled_exercise/v2.rb +33 -0
  10. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +3 -1
  11. data/lib/kitchen/directions/bake_chapter_references/v1.rb +1 -1
  12. data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +1 -1
  13. data/lib/kitchen/directions/bake_chapter_summary.rb +1 -1
  14. data/lib/kitchen/directions/bake_figure.rb +1 -14
  15. data/lib/kitchen/directions/bake_iframes/v1.rb +2 -0
  16. data/lib/kitchen/directions/bake_injected_exercise/add_injected_exercise_id.rb +16 -0
  17. data/lib/kitchen/directions/{bake_injected_exercise_question.rb → bake_injected_exercise/bake_injected_exercise_question.rb} +0 -0
  18. data/lib/kitchen/directions/bake_learning_objectives.rb +13 -0
  19. data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +1 -14
  20. data/lib/kitchen/directions/bake_notes/bake_note_exercise.rb +54 -0
  21. data/lib/kitchen/directions/bake_notes/bake_note_injected_question.rb +15 -0
  22. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +0 -31
  23. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +2 -2
  24. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +2 -2
  25. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +2 -2
  26. data/lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb +5 -3
  27. data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +3 -0
  28. data/lib/kitchen/directions/bake_references/main.rb +6 -9
  29. data/lib/kitchen/directions/bake_references/v1.rb +9 -8
  30. data/lib/kitchen/directions/bake_references/v2.rb +9 -10
  31. data/lib/kitchen/directions/bake_references/v3.rb +32 -0
  32. data/lib/kitchen/directions/bake_unnumbered_figure.rb +26 -0
  33. data/lib/kitchen/directions/bake_unnumbered_tables.rb +1 -0
  34. data/lib/kitchen/directions/{eoc_composite_page_container → composite_page_container}/main.rb +1 -1
  35. data/lib/kitchen/directions/composite_page_container/v1.rb +28 -0
  36. data/lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb +1 -1
  37. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +3 -1
  38. data/lib/kitchen/element_base.rb +10 -18
  39. data/lib/kitchen/element_enumerator_base.rb +35 -0
  40. data/lib/kitchen/example_element.rb +2 -1
  41. data/lib/kitchen/figure_element.rb +12 -4
  42. data/lib/kitchen/metadata_element.rb +6 -1
  43. data/lib/kitchen/note_element.rb +19 -5
  44. data/lib/kitchen/section_element.rb +27 -0
  45. data/lib/kitchen/section_element_enumerator.rb +20 -0
  46. data/lib/kitchen/selectors/base.rb +3 -0
  47. data/lib/kitchen/selectors/standard_1.rb +1 -0
  48. data/lib/kitchen/table_element.rb +8 -0
  49. data/lib/kitchen/templates/composite_page_template.xhtml.erb +10 -0
  50. data/lib/kitchen/version.rb +1 -1
  51. data/lib/locales/en.yml +4 -0
  52. data/lib/locales/es.yml +3 -0
  53. data/lib/locales/pl.yml +3 -0
  54. metadata +15 -7
  55. data/lib/kitchen/directions/eoc_composite_page_container/v1.rb +0 -19
  56. data/lib/kitchen/templates/eoc_section_template.xhtml.erb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddc1370c1b05b52bdf0df2f0a7cd4624b1725f39aae33f57f9715e091a358f8d
4
- data.tar.gz: fcd328b3dd9c091f2461e3acd22db036c02c4005bb5c8f31071096ed96461179
3
+ metadata.gz: fe096a5d1994a88a6a1e3d0d585bc76ff216157550eec29df3a37da3aa36f229
4
+ data.tar.gz: 38f20f8be2ae246005c047ea0702e0e2a266b039e534fe0b063157054609873d
5
5
  SHA512:
6
- metadata.gz: fd04ee2890144c697d9ab1ff10f97b9593f594eca116856bc6f26edb51f28e6330a0daca42c23e29d7bc08f2d336e764c957dcf93d6f638a22be1572a3ab939c
7
- data.tar.gz: bb270311e092585ef966c4f2ba76d8847d7fbaedaae9c102274363ac5c21bbf411a6af5ebd7689c6b8ffd02d81ea46b586cd2273eab26320f21c559d28019bcb
6
+ metadata.gz: 20d6729f702ada57a80cf10bf5851562e1649e10ff002f98dc56a30f438aecee2b242e7a377af49313344b73b604d690eb2c8f7acd903cddafd32a0b7505fc2f
7
+ data.tar.gz: bf8d77b0693a23cc1332d5c40c6eea39aeed0e1b1cb3c83017d60ad3541280c210fde867063551c52afe5e76198add5cfd5af960ab55b3f0cd617492e262658c
data/CHANGELOG.md CHANGED
@@ -6,6 +6,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [14.0.0] - 2021-10-22
10
+
11
+ Fix `BakeAutotitledExercise` V2 to stop breaking for exercises without solutions (patch)
12
+ Add `BakeAutotitledExercise` V2 (minor)
13
+ Fix `BakeChapterGlossary::V1` to stop adding an empty wrapper if there is no content (patch)
14
+ * Create `BakeNoteExercise` and `BakeNoteInjectedQuestion` and support exercises in `BakeUnclassifiedNotes` (minor)
15
+ * Add baking section with class `column header` to `BakeAppendix` (patch)
16
+ * Expand `BakeAnnotationClasses` to book from chapter to bake also paragraphs from Preface (major)
17
+ * Create separate direction `BakeUnnumberedFigure`, clean `BakeFigure` to not match unnumbered figures , rename and update `figure_to_bake?` method to `figure_to_number?` to support only numbered figures except subfigures (major)
18
+
19
+ ## [13.0.0] - 2021-10-6
20
+
21
+ * Add `BakeLearningObjectives` v3 (minor)
22
+ * Fix `BakeIframes` to skip already-baked iframes (patch)
23
+ * Add `SectionElement` and `SectionElementEnumerator` classes (minor)
24
+ * Refactor `EocCompositePageContainer` to be used by `EOB` sections as well (major)
25
+ * Refactor `bake_references` `v1, v2 and v3` to use `CompositePageContainer` (major)
26
+
27
+ ## [12.2.0] - 2021-10-1
28
+
29
+ * Add `context_lead_text` to translations (minor)
30
+ * Make `ElementBase#search_with` callable from an `ElementEnumerator` (minor)
31
+ * Support top-titled tables in `BakeUnnumberedTables` (minor)
32
+ * Stop `NoteElement#title` from breaking for empty notes (patch)
33
+ * Add text heavy tables to `BakeTableBody` (minor)
34
+ * Modify `BakeAutotitledNotes` to bake unnumbered exercises with solution (minor)
35
+ * Create `AddInjectedExerciseId` to separate creating ids from `BakeInjectedExerciseQuestion` (minor)
36
+ * Rework `AddInjectedExerciseId` to use loop inside module (minor)
37
+
38
+ ## [12.1.0] - 2021-09-24
39
+
40
+ * Fix `BakeExample#titles_to_rename` to exclude exercise titles (patch)
41
+ * Modify `BakeFigure` to bake unnumbered figures with caption (minor)
42
+ * Fix `NoteElement#title` to be more specific about finding the title (patch)
43
+ * Adds `data-type="slug"` to `metadata_lement` `children_to_keep` method, updates spec helper `metadata_element` and related spec files(minor)
44
+
9
45
  ## [12.0.0] - 2021-09-21
10
46
 
11
47
  * Fixes `BakeStepwise` to skip nested lists (patch)
data/Gemfile CHANGED
@@ -9,3 +9,4 @@ gem 'rake', '~> 12.0'
9
9
  gem 'rspec', '~> 3.0'
10
10
 
11
11
  gem 'codecov', require: false
12
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (12.0.0)
4
+ openstax_kitchen (14.0.0)
5
5
  activesupport
6
6
  i18n
7
7
  nokogiri
@@ -107,7 +107,7 @@ GEM
107
107
  concurrent-ruby (~> 1.0)
108
108
  unicode-display_width (1.7.0)
109
109
  yard (0.9.24)
110
- zeitwerk (2.4.2)
110
+ zeitwerk (2.5.1)
111
111
 
112
112
  PLATFORMS
113
113
  ruby
@@ -3,9 +3,9 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeAnnotationClasses
6
- def self.v1(chapter:)
6
+ def self.v1(book:)
7
7
  V1.new.bake(
8
- chapter: chapter)
8
+ book: book)
9
9
  end
10
10
  end
11
11
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Kitchen::Directions::BakeAnnotationClasses
4
4
  class V1
5
- def bake(chapter:)
6
- chapter.search('p.annotation').each do |annotation|
5
+ def bake(book:)
6
+ book.search('p.annotation').each do |annotation|
7
7
  annotation.wrap_children('span', class: 'os-text')
8
8
  annotation.prepend(child:
9
9
  <<~HTML
@@ -19,7 +19,7 @@ module Kitchen::Directions::BakeAnnotationClasses
19
19
  auditory-icon
20
20
  kinesthetic-icon]
21
21
  annotation_icon_classes.each do |annotation_icon_class|
22
- chapter.search("p.#{annotation_icon_class}").each do |annotation_with_icon_class|
22
+ book.search("p.#{annotation_icon_class}").each do |annotation_with_icon_class|
23
23
  annotation_with_icon_class.search('div.os-icons').first.append(child:
24
24
  <<~HTML
25
25
  <span class = "#{annotation_icon_class}"></span>
@@ -21,6 +21,7 @@ module Kitchen
21
21
  next unless title.present?
22
22
 
23
23
  title.name = "h#{section['data-depth'].to_i + 1}"
24
+ section.name = 'div' if section.has_class?('column-container')
24
25
  end
25
26
  end
26
27
  end
@@ -6,6 +6,10 @@ module Kitchen
6
6
  def self.v1(exercise:, number: nil)
7
7
  V1.new.bake(exercise: exercise, number: number)
8
8
  end
9
+
10
+ def self.v2(exercise:, title:)
11
+ V2.new.bake(exercise: exercise, title: title)
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen::Directions::BakeAutotitledExercise
4
+ # Differences from V1:
5
+ # 1. Title is an <h3><span>, not <h4>, & above the problem instead of within it
6
+ # 2. Title is generated in the recipe and passed to the method
7
+ class V2
8
+ def bake(exercise:, title:)
9
+ exercise.add_class('unnumbered')
10
+ exercise.titles.first&.trash
11
+
12
+ # bake problem
13
+ exercise.prepend(child:
14
+ <<~HTML
15
+ <h3 class="os-title" data-type="title">
16
+ <span class="os-title-label">#{title}</span>
17
+ </h3>
18
+ HTML
19
+ )
20
+ exercise.problem.wrap_children(class: 'os-problem-container')
21
+ return unless exercise.solution
22
+
23
+ exercise.solution.wrap_children(class: 'os-solution-container')
24
+ exercise.solution.prepend(child:
25
+ <<~HTML
26
+ <h4 class="solution-title" data-type="title">
27
+ <span class="os-text">#{I18n.t(:solution)}</span>
28
+ </h4>
29
+ HTML
30
+ )
31
+ end
32
+ end
33
+ end
@@ -41,7 +41,9 @@ module Kitchen::Directions::BakeChapterGlossary
41
41
 
42
42
  content = @glossary.sort.map { |definition| definition.element.paste }.join
43
43
 
44
- Kitchen::Directions::EocCompositePageContainer.v1(
44
+ return if content.empty?
45
+
46
+ Kitchen::Directions::CompositePageContainer.v1(
45
47
  container_key: 'glossary',
46
48
  uuid_key: "#{uuid_prefix}glossary",
47
49
  metadata_source: metadata_source,
@@ -11,7 +11,7 @@ module Kitchen::Directions::BakeChapterReferences
11
11
 
12
12
  content = chapter.pages.references.cut.paste
13
13
 
14
- Kitchen::Directions::EocCompositePageContainer.v1(
14
+ Kitchen::Directions::CompositePageContainer.v1(
15
15
  container_key: klass,
16
16
  uuid_key: "#{uuid_prefix}#{klass}",
17
17
  metadata_source: metadata_source,
@@ -23,7 +23,7 @@ module Kitchen::Directions::BakeChapterSolutions
23
23
 
24
24
  content = solutions_clipboard.paste
25
25
 
26
- Kitchen::Directions::EocCompositePageContainer.v1(
26
+ Kitchen::Directions::CompositePageContainer.v1(
27
27
  container_key: 'solutions',
28
28
  uuid_key: "#{uuid_prefix}solutions",
29
29
  metadata_source: metadata_source,
@@ -31,7 +31,7 @@ module Kitchen
31
31
 
32
32
  return if summaries.none?
33
33
 
34
- EocCompositePageContainer.v1(
34
+ CompositePageContainer.v1(
35
35
  container_key: klass,
36
36
  uuid_key: "#{uuid_prefix}#{klass}",
37
37
  metadata_source: metadata_source,
@@ -4,26 +4,13 @@ module Kitchen
4
4
  module Directions
5
5
  module BakeFigure
6
6
  def self.v1(figure:, number:, cases: false)
7
- return if figure.has_class?('unnumbered') && !figure.has_class?('splash')
8
-
7
+ warn 'warning! exclude unnumbered figures from `BakeFigure` loop' if figure.unnumbered?
9
8
  figure.wrap(%(<div class="os-figure#{' has-splash' if figure.has_class?('splash')}">))
10
- if figure.has_class?('unnumbered') && figure.has_class?('splash')
11
- caption = figure.caption&.cut
12
- figure.append(sibling:
13
- <<~HTML
14
- <div class="os-caption-container">
15
- #{"<span class=\"os-caption\">#{caption.children}</span>" if caption}
16
- </div>
17
- HTML
18
- )
19
- return
20
- end
21
9
 
22
10
  # Store label information
23
11
  figure.target_label(label_text: 'figure', custom_content: number, cases: cases)
24
12
 
25
13
  title = figure.title&.cut
26
-
27
14
  caption = figure.caption&.cut
28
15
  figure.append(sibling:
29
16
  <<~HTML
@@ -7,6 +7,8 @@ module Kitchen::Directions::BakeIframes
7
7
  return unless iframes.any?
8
8
 
9
9
  iframes.each do |iframe|
10
+ next if iframe.has_class?('os-is-iframe')
11
+
10
12
  iframe.wrap('<div class="os-has-iframe" data-type="alternatives">')
11
13
  iframe.add_class('os-is-iframe')
12
14
  link_ref = iframe[:src]
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ # Ids should be added before exercises are moved to EOC,
6
+ # since they're using part of the ancestor page id.
7
+ #
8
+ # In some books exercises are numbered after moving.
9
+ # That's why this step has to be separated from BakeInjectedExerciseQuestion
10
+ module AddInjectedExerciseId
11
+ def self.v1(book:)
12
+ book.pages.injected_questions.each(&:id)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -30,6 +30,19 @@ module Kitchen
30
30
  end
31
31
  end
32
32
  end
33
+
34
+ # Wraps & moves abstract under the corresponding chapter objective in the intro page
35
+ def self.v3(chapter:)
36
+ abstracts = chapter.abstracts.map do |abstract|
37
+ abstract.wrap('<div class="learning-objective">')
38
+ abstract.parent
39
+ end
40
+
41
+ chapter.introduction_page.search('div.os-chapter-objective') \
42
+ .each_with_index do |objective, index|
43
+ objective.append(child: abstracts[index].cut.paste)
44
+ end
45
+ end
33
46
  end
34
47
  end
35
48
  end
@@ -30,20 +30,7 @@ module Kitchen
30
30
  HTML
31
31
  )
32
32
 
33
- bake_unclassified_exercises(note: note) if bake_exercises
34
- end
35
-
36
- def self.bake_unclassified_exercises(note:)
37
- note.exercises.each do |exercise|
38
- exercise.problem.wrap_children('div', class: 'os-problem-container')
39
-
40
- exercise.problem.prepend(child:
41
- <<~HTML
42
- <span class="os-title-label">#{I18n.t(:"exercises.exercise")} </span>
43
- <span class="os-number">#{exercise.count_in(:note)}</span>
44
- HTML
45
- )
46
- end
33
+ BakeNoteExercise.v2(note: note) if bake_exercises
47
34
  end
48
35
  end
49
36
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ module BakeNoteExercise
6
+ def self.v1(note:, exercise:, divider: ' ', suppress_solution: false)
7
+ exercise.add_class('unnumbered')
8
+ number = note.first('.os-number').text.gsub(/#/, '')
9
+
10
+ # bake problem
11
+ exercise.problem.wrap_children('div', class: 'os-problem-container')
12
+ exercise.search('[data-type="commentary"]').each(&:trash)
13
+ return unless exercise.solution
14
+
15
+ # bake solution in place
16
+ if suppress_solution
17
+ exercise.add_class('os-hasSolution')
18
+ exercise.solution.trash
19
+ else
20
+ BakeNumberedExercise.bake_solution_v1(
21
+ exercise: exercise,
22
+ number: number,
23
+ divider: divider
24
+ )
25
+ end
26
+ end
27
+
28
+ def self.v2(note:)
29
+ note.exercises.each do |exercise|
30
+ exercise.problem.wrap_children('div', class: 'os-problem-container')
31
+
32
+ unless exercise.has_class?('unnumbered')
33
+ exercise.problem.prepend(child:
34
+ <<~HTML
35
+ <span class="os-title-label">#{I18n.t(:"exercises.exercise")} </span>
36
+ <span class="os-number">#{exercise.count_in(:note)}</span>
37
+ HTML
38
+ )
39
+ end
40
+
41
+ next unless exercise.solution
42
+
43
+ exercise.solution.wrap_children('div', class: 'os-solution-container')
44
+
45
+ exercise.solution.prepend(child:
46
+ <<~HTML
47
+ <span class="os-title-label">#{I18n.t(:"exercises.solution")}</span>
48
+ HTML
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ module BakeNoteInjectedQuestion
6
+ def self.v1(note:, question:)
7
+ question.add_class('unnumbered')
8
+ number = note.first('.os-number').text.gsub(/#/, '')
9
+ Kitchen::Directions::BakeInjectedExerciseQuestion.v1(
10
+ question: question, number: number, only_number_solution: true
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -17,37 +17,6 @@ module Kitchen
17
17
  def self.v3(book:, classes:, suppress_solution: true)
18
18
  V3.new.bake(book: book, classes: classes, suppress_solution: suppress_solution)
19
19
  end
20
-
21
- # Used by V1, V2, V3
22
- def self.bake_note_exercise(note:, exercise:, divider: ' ', suppress_solution: false)
23
- exercise.add_class('unnumbered')
24
- number = note.first('.os-number').text.gsub(/#/, '')
25
-
26
- # bake problem
27
- exercise.problem.wrap_children('div', class: 'os-problem-container')
28
- exercise.search('[data-type="commentary"]').each(&:trash)
29
- return unless exercise.solution
30
-
31
- # bake solution in place
32
- if suppress_solution
33
- exercise.add_class('os-hasSolution')
34
- exercise.solution.trash
35
- else
36
- BakeNumberedExercise.bake_solution_v1(
37
- exercise: exercise,
38
- number: number,
39
- divider: divider
40
- )
41
- end
42
- end
43
-
44
- def self.bake_note_injected_question(note:, question:)
45
- question.add_class('unnumbered')
46
- number = note.first('.os-number').text.gsub(/#/, '')
47
- Kitchen::Directions::BakeInjectedExerciseQuestion.v1(
48
- question: question, number: number, only_number_solution: true
49
- )
50
- end
51
20
  end
52
21
  end
53
22
  end
@@ -8,10 +8,10 @@ module Kitchen::Directions
8
8
  book.chapters.pages.notes("$.#{klass}").each do |note|
9
9
  bake_note(note: note, cases: cases)
10
10
  note.exercises.each do |exercise|
11
- BakeNumberedNotes.bake_note_exercise(note: note, exercise: exercise)
11
+ BakeNoteExercise.v1(note: note, exercise: exercise)
12
12
  end
13
13
  note.injected_questions.each do |question|
14
- BakeNumberedNotes.bake_note_injected_question(note: note, question: question)
14
+ BakeNoteInjectedQuestion.v1(note: note, question: question)
15
15
  end
16
16
  end
17
17
  end
@@ -17,10 +17,10 @@ module Kitchen::Directions
17
17
  HTML
18
18
  )
19
19
  note.exercises.each do |exercise|
20
- BakeNumberedNotes.bake_note_exercise(note: note, exercise: exercise, divider: '. ')
20
+ BakeNoteExercise.v1(note: note, exercise: exercise, divider: '. ')
21
21
  end
22
22
  note.injected_questions.each do |question|
23
- BakeNumberedNotes.bake_note_injected_question(note: note, question: question)
23
+ BakeNoteInjectedQuestion.v1(note: note, question: question)
24
24
  end
25
25
  end
26
26
  end
@@ -25,12 +25,12 @@ module Kitchen::Directions
25
25
 
26
26
  note.title&.trash
27
27
  note.exercises.each do |exercise|
28
- BakeNumberedNotes.bake_note_exercise(
28
+ BakeNoteExercise.v1(
29
29
  note: note, exercise: exercise, divider: '. ', suppress_solution: suppress_solution
30
30
  )
31
31
  end
32
32
  note.injected_questions.each do |question|
33
- BakeNumberedNotes.bake_note_injected_question(note: note, question: question)
33
+ BakeNoteInjectedQuestion.v1(note: note, question: question)
34
34
  end
35
35
 
36
36
  note.search("div[data-type='solution']").each&.trash if suppress_solution
@@ -3,15 +3,15 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeUnclassifiedNotes
6
- def self.v1(book:)
6
+ def self.v1(book:, bake_exercises: false)
7
7
  book.notes.each do |note|
8
8
  next unless note.classes.empty?
9
9
 
10
- bake_note(note: note)
10
+ bake_note(note: note, bake_exercises: bake_exercises)
11
11
  end
12
12
  end
13
13
 
14
- def self.bake_note(note:)
14
+ def self.bake_note(note:, bake_exercises:)
15
15
  note.wrap_children(class: 'os-note-body')
16
16
 
17
17
  title = note.title&.cut
@@ -24,6 +24,8 @@ module Kitchen
24
24
  </h3>
25
25
  HTML
26
26
  )
27
+
28
+ BakeNoteExercise.v2(note: note) if bake_exercises
27
29
  end
28
30
  end
29
31
  end
@@ -62,6 +62,9 @@ module Kitchen
62
62
  elsif table.column_header?
63
63
  custom_table = CustomBody.new(table: table, klass: 'column-header')
64
64
  custom_table.modify_body(has_fake_title: false)
65
+ elsif table.text_heavy?
66
+ custom_table = CustomBody.new(table: table, klass: 'text-heavy')
67
+ custom_table.modify_body(has_fake_title: false)
65
68
  end
66
69
  end
67
70
  end
@@ -6,18 +6,15 @@ module Kitchen
6
6
  #
7
7
  module BakeReferences
8
8
  def self.v1(book:, metadata_source:, numbered_title: false)
9
- V1.new.bake(
10
- book: book,
11
- metadata_source: metadata_source,
12
- numbered_title: numbered_title
13
- )
9
+ V1.new.bake(book: book, metadata_source: metadata_source, numbered_title: numbered_title)
14
10
  end
15
11
 
16
12
  def self.v2(book:, metadata_source:)
17
- V2.new.bake(
18
- book: book,
19
- metadata_source: metadata_source
20
- )
13
+ V2.new.bake(book: book, metadata_source: metadata_source)
14
+ end
15
+
16
+ def self.v3(book:, metadata_source:)
17
+ V3.new.bake(book: book, metadata_source: metadata_source)
21
18
  end
22
19
  end
23
20
  end
@@ -5,11 +5,6 @@ module Kitchen::Directions::BakeReferences
5
5
  renderable
6
6
 
7
7
  def bake(book:, metadata_source:, numbered_title:)
8
- @metadata = metadata_source.children_to_keep.copy
9
- @klass = 'reference'
10
- @uuid_prefix = '.'
11
- @title = I18n.t(:references)
12
-
13
8
  book.chapters.each do |chapter|
14
9
  chapter.search('[data-type="cite"]').each do |link|
15
10
  link.prepend(child:
@@ -44,10 +39,16 @@ module Kitchen::Directions::BakeReferences
44
39
  HTML
45
40
  )
46
41
  end
42
+
47
43
  chapter_area_references = book.chapters.search('.os-chapter-area').cut
48
- @content = chapter_area_references.paste
49
- book.body.append(child: render(file:
50
- '../../templates/eob_section_title_template.xhtml.erb'))
44
+
45
+ Kitchen::Directions::CompositePageContainer.v1(
46
+ container_key: 'reference',
47
+ uuid_key: '.reference',
48
+ metadata_source: metadata_source,
49
+ content: chapter_area_references.paste,
50
+ append_to: book.body
51
+ )
51
52
  end
52
53
  end
53
54
  end
@@ -2,14 +2,7 @@
2
2
 
3
3
  module Kitchen::Directions::BakeReferences
4
4
  class V2
5
- renderable
6
-
7
5
  def bake(book:, metadata_source:)
8
- @metadata = metadata_source.children_to_keep.copy
9
- @klass = 'references'
10
- @uuid_prefix = '.'
11
- @title = I18n.t(:references)
12
-
13
6
  book.chapters.each do |chapter|
14
7
 
15
8
  chapter.references.search('h3').trash
@@ -26,10 +19,16 @@ module Kitchen::Directions::BakeReferences
26
19
  HTML
27
20
  )
28
21
  end
22
+
29
23
  chapter_area_references = book.chapters.search('.os-chapter-area').cut
30
- @content = chapter_area_references.paste
31
- book.body.append(child: render(file:
32
- '../../templates/eob_section_title_template.xhtml.erb'))
24
+
25
+ Kitchen::Directions::CompositePageContainer.v1(
26
+ container_key: 'references',
27
+ uuid_key: '.references',
28
+ metadata_source: metadata_source,
29
+ content: chapter_area_references.paste,
30
+ append_to: book.body
31
+ )
33
32
  end
34
33
  end
35
34
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen::Directions::BakeReferences
4
+ class V3
5
+ def bake(book:, metadata_source:)
6
+ return unless book.references.any?
7
+
8
+ book.chapters.pages.each do |page|
9
+ page.references.each do |reference|
10
+ reference.titles.trash
11
+ reference.prepend(child:
12
+ Kitchen::Directions::EocSectionTitleLinkSnippet.v1(
13
+ page: page,
14
+ title_tag: 'h2',
15
+ wrapper: nil
16
+ )
17
+ )
18
+ end
19
+ end
20
+
21
+ chapter_area_references = book.chapters.references.cut
22
+
23
+ Kitchen::Directions::CompositePageContainer.v1(
24
+ container_key: 'references',
25
+ uuid_key: '.references',
26
+ metadata_source: metadata_source,
27
+ content: chapter_area_references.paste,
28
+ append_to: book.body
29
+ )
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ module BakeUnnumberedFigure
6
+ def self.v1(book:)
7
+ book.figures(only: :unnumbered?).each do |figure|
8
+ next unless figure.caption || figure.title
9
+
10
+ figure.wrap(%(<div class="os-figure#{' has-splash' if figure.has_class?('splash')}">))
11
+ title = figure.title&.cut
12
+ caption = figure.caption&.cut
13
+ figure.append(sibling:
14
+ <<~HTML
15
+ <div class="os-caption-container">
16
+ #{"<span class=\"os-title\" data-type=\"title\" id=\"#{title.id}\">#{title.children}</span>" if title}
17
+ #{'<span class="os-divider"> </span>' if title && caption}
18
+ #{"<span class=\"os-caption\">#{caption.children}</span>" if caption}
19
+ </div>
20
+ HTML
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -9,6 +9,7 @@ module Kitchen
9
9
  table.remove_attribute('summary')
10
10
  table.parent.add_class('os-unstyled-container') if table.unstyled?
11
11
  table.parent.add_class('os-column-header-container') if table.column_header?
12
+ table.parent.add_class('os-top-titled-container') if table.top_titled?
12
13
  end
13
14
  end
14
15
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Kitchen
4
4
  module Directions
5
- module EocCompositePageContainer
5
+ module CompositePageContainer
6
6
  # Creates a wrapper for the given content & appends it to the given element
7
7
  #
8
8
  # @param container_key [String] Appended to 'eoc.' to form the I18n key for the container title; also used as part of a class on the container.
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen::Directions::CompositePageContainer
4
+ class V1
5
+ renderable
6
+
7
+ def bake(container_key:, uuid_key:, metadata_source:, content:, append_to:)
8
+ @in_composite_chapter = append_to.is?(:composite_chapter)
9
+ @is_eoc = append_to.is?(:chapter) || @in_composite_chapter
10
+ @section = @is_eoc ? 'eoc' : 'eob'
11
+ @title = I18n.t(:"#{@section}.#{container_key}")
12
+ @uuid_key = uuid_key
13
+ @container_class_type = container_key
14
+ @metadata = metadata_source.children_to_keep.copy
15
+ @content = content
16
+ @main_title_tag = 'h1'
17
+
18
+ if @in_composite_chapter
19
+ @main_title_tag = 'h3'
20
+ elsif @is_eoc
21
+ @main_title_tag = 'h2'
22
+ end
23
+
24
+ append_to.append(child: render(file:
25
+ '../../templates/composite_page_template.xhtml.erb'))
26
+ end
27
+ end
28
+ end
@@ -30,7 +30,7 @@ module Kitchen::Directions::MoveCustomSectionToEocContainer
30
30
  section_clipboard.paste
31
31
  end
32
32
 
33
- Kitchen::Directions::EocCompositePageContainer.v1(
33
+ Kitchen::Directions::CompositePageContainer.v1(
34
34
  container_key: container_key,
35
35
  uuid_key: uuid_key,
36
36
  metadata_source: metadata_source,
@@ -38,7 +38,9 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
38
38
  </div>
39
39
  HTML
40
40
  )
41
- strategy.bake(chapter: chapter, append_to: append_to.first("[data-uuid-key='#{uuid_key}']"))
41
+ strategy.bake(
42
+ chapter: chapter, append_to: append_to.first("div[data-uuid-key='#{uuid_key}']")
43
+ )
42
44
  end
43
45
  # rubocop:enable Metrics/ParameterLists
44
46
  end
@@ -211,6 +211,14 @@ module Kitchen
211
211
  self[:id] = value
212
212
  end
213
213
 
214
+ # Returns the element's data-type
215
+ #
216
+ # @return [String]
217
+ #
218
+ def data_type
219
+ self[:'data-type']
220
+ end
221
+
214
222
  # A way to set values and chain them
215
223
  #
216
224
  # @param property [String, Symbol] the name of the property to set
@@ -419,23 +427,6 @@ module Kitchen
419
427
  )
420
428
  end
421
429
 
422
- # Searches for elements handled by a list of enumerator classes. All element that
423
- # matches one of those enumerator classes are iterated over.
424
- #
425
- # @param enumerator_classes [Array<ElementEnumeratorBase>]
426
- # @return [TypeCastingElementEnumerator]
427
- #
428
- def search_with(*enumerator_classes)
429
- block_error_if(block_given?)
430
- raise 'must supply at least one enumerator class' if enumerator_classes.empty?
431
-
432
- factory = enumerator_classes[0].factory
433
- enumerator_classes[1..-1].each do |enumerator_class|
434
- factory = factory.or_with(enumerator_class.factory)
435
- end
436
- factory.build_within(self)
437
- end
438
-
439
430
  # Removes the element from its parent and places it on the specified clipboard
440
431
  #
441
432
  # @param to [Symbol, String, Clipboard, nil] the name of the clipboard (or a Clipboard
@@ -762,7 +753,8 @@ module Kitchen
762
753
  # Returns a pages enumerator
763
754
  def_delegators :as_enumerator, :pages, :chapters, :terms, :figures, :notes, :tables, :examples,
764
755
  :metadatas, :non_introduction_pages, :units, :titles, :exercises, :references,
765
- :composite_pages, :composite_chapters, :solutions, :injected_questions
756
+ :composite_pages, :composite_chapters, :solutions, :injected_questions,
757
+ :search_with, :sections
766
758
 
767
759
  # Returns this element as an enumerator (over only one element, itself)
768
760
  #
@@ -318,6 +318,24 @@ module Kitchen
318
318
  css_or_xpath: css_or_xpath, only: only, except: except)
319
319
  end
320
320
 
321
+ # Returns an enumerator that iterates through sections within the scope of this enumerator
322
+ #
323
+ # @param css_or_xpath [String] additional selectors to further narrow the element iterated over;
324
+ # a "$" in this argument will be replaced with the default selector for the element being
325
+ # iterated over.
326
+ # @param only [Symbol, Callable] the name of a method to call on an element or a
327
+ # lambda or proc that accepts an element; elements will only be included in the
328
+ # search results if the method or callable returns true
329
+ # @param except [Symbol, Callable] the name of a method to call on an element or a
330
+ # lambda or proc that accepts an element; elements will not be included in the
331
+ # search results if the method or callable returns false
332
+ #
333
+ def sections(css_or_xpath=nil, only: nil, except: nil)
334
+ block_error_if(block_given?)
335
+ chain_to(SectionElementEnumerator,
336
+ css_or_xpath: css_or_xpath, only: only, except: except)
337
+ end
338
+
321
339
  # Returns an enumerator that iterates within the scope of this enumerator
322
340
  #
323
341
  # @param css_or_xpath [String] additional selectors to further narrow the element iterated over
@@ -327,6 +345,23 @@ module Kitchen
327
345
  chain_to(ElementEnumerator, css_or_xpath: css_or_xpath, only: only, except: except)
328
346
  end
329
347
 
348
+ # Searches for elements handled by a list of enumerator classes. All element that
349
+ # matches one of those enumerator classes are iterated over.
350
+ #
351
+ # @param enumerator_classes [Array<ElementEnumeratorBase>]
352
+ # @return [TypeCastingElementEnumerator]
353
+ #
354
+ def search_with(*enumerator_classes)
355
+ block_error_if(block_given?)
356
+ raise 'must supply at least one enumerator class' if enumerator_classes.empty?
357
+
358
+ factory = enumerator_classes[0].factory
359
+ enumerator_classes[1..-1].each do |enumerator_class|
360
+ factory = factory.or_with(enumerator_class.factory)
361
+ end
362
+ factory.build_within(self)
363
+ end
364
+
330
365
  # Returns an enumerator that iterates through elements within the scope of this enumerator
331
366
  #
332
367
  # @param enumerator_class [ElementEnumeratorBase] the enumerator to use for the iteration
@@ -33,7 +33,8 @@ module Kitchen
33
33
  title.parent.has_class?('os-caption-container') || \
34
34
  title.parent.has_class?('os-caption') || \
35
35
  title.parent.name == 'caption' || \
36
- title.parent[:'data-type'] == 'note'
36
+ title.parent.data_type == 'note' || \
37
+ title.parent.data_type == 'exercise'
37
38
  end
38
39
  )
39
40
  end
@@ -47,16 +47,24 @@ module Kitchen
47
47
  parent.name == 'figure'
48
48
  end
49
49
 
50
+ # Returns true if the figure is unnumbered
51
+ #
52
+ # @return [Boolean]
53
+ #
54
+
55
+ def unnumbered?
56
+ has_class?('unnumbered')
57
+ end
58
+
50
59
  # Returns true unless the figure is a subfigure or has the 'unnumbered' class,
51
60
  # unless the figure has both the 'unnumbered' and the 'splash' classes.
52
61
  #
53
62
  # @return [Boolean]
54
- #
55
- def figure_to_bake?
56
- return false if subfigure? || (has_class?('unnumbered') && !has_class?('splash'))
63
+
64
+ def figure_to_number?
65
+ return false if subfigure? || unnumbered?
57
66
 
58
67
  true
59
68
  end
60
-
61
69
  end
62
70
  end
@@ -27,7 +27,12 @@ module Kitchen
27
27
  # @return [ElementEnumerator]
28
28
  #
29
29
  def children_to_keep
30
- search(%w(span[data-type='revised'] div.authors div.publishers div.print-style div.permissions
30
+ search(%w(span[data-type='revised']
31
+ span[data-type='slug']
32
+ div.authors
33
+ div.publishers
34
+ div.print-style
35
+ div.permissions
31
36
  div[data-type='subject']))
32
37
  end
33
38
  end
@@ -29,16 +29,30 @@ module Kitchen
29
29
  #
30
30
  def title
31
31
  block_error_if(block_given?)
32
- note_body = first('div.os-note-body')
33
- first_child = note_body ? note_body.element_children[0] : element_children[0]
32
+ # An element with data-type="title" is ambiguous; it is only the note's title if:
33
+ # 1. it is the note body's first child
34
+ # 2. it is the first child's first child and the first child is a paragraph
35
+ first_child = first_note_body_child
36
+ return unless first_child
37
+
38
+ first_grandchild = get_first_grandchild_for_title(first_child)
34
39
 
35
- if first_child[:'data-type'] == 'title'
40
+ if first_child.data_type == 'title'
36
41
  first_child
37
- elsif first_child&.element_children&.[](0)&.[](:'data-type') == 'title'
38
- first_child.element_children[0]
42
+ elsif first_grandchild&.data_type == 'title'
43
+ first_grandchild
39
44
  end
40
45
  end
41
46
 
47
+ def first_note_body_child
48
+ note_body = first('div.os-note-body')
49
+ note_body ? note_body.element_children[0] : element_children[0]
50
+ end
51
+
52
+ def get_first_grandchild_for_title(first_child)
53
+ first_child&.element_children&.[](0) if first_child.name == 'p'
54
+ end
55
+
42
56
  # Returns true if the note's title is autogenerated
43
57
  #
44
58
  # @return [Boolean]
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ # An element for an example
5
+ #
6
+ class SectionElement < ElementBase
7
+
8
+ # Creates a new +SectionElement+
9
+ #
10
+ # @param node [Nokogiri::XML::Node] the node this element wraps
11
+ # @param document [Document] this element's document
12
+ #
13
+ def initialize(node:, document: nil)
14
+ super(node: node,
15
+ document: document,
16
+ enumerator_class: SectionElementEnumerator)
17
+ end
18
+
19
+ # Returns the short type
20
+ # @return [Symbol]
21
+ #
22
+ def self.short_type
23
+ :section
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ # An enumerator for table elements
5
+ #
6
+ class SectionElementEnumerator < ElementEnumeratorBase
7
+ # Returns a factory for this enumerator
8
+ #
9
+ # @return [ElementEnumeratorFactory]
10
+ #
11
+ def self.factory
12
+ ElementEnumeratorFactory.new(
13
+ default_css_or_xpath: Selector.named(:section),
14
+ sub_element_class: SectionElement,
15
+ enumerator_class: self
16
+ )
17
+ end
18
+
19
+ end
20
+ end
@@ -62,6 +62,9 @@ module Kitchen
62
62
  # Selector for an injected question
63
63
  # @return [String]
64
64
  attr_accessor :injected_question
65
+ # Selector for a section
66
+ # @return [String]
67
+ attr_accessor :section
65
68
 
66
69
  # Override specific selectors
67
70
  #
@@ -29,6 +29,7 @@ module Kitchen
29
29
  self.solution = "div[data-type='solution'], " \
30
30
  "div[data-type='question-solution']"
31
31
  self.injected_question = "div[data-type='exercise-question']"
32
+ self.section = 'section'
32
33
  end
33
34
 
34
35
  end
@@ -97,6 +97,14 @@ module Kitchen
97
97
  has_class?('column-header')
98
98
  end
99
99
 
100
+ # Returns true if the table is text heavy
101
+ #
102
+ # @return [Boolean]
103
+ #
104
+ def text_heavy?
105
+ has_class?('text-heavy')
106
+ end
107
+
100
108
  # Returns an element for the table caption, if present
101
109
  #
102
110
  # @return [Element, nil]
@@ -0,0 +1,10 @@
1
+ <div class="os-<%= @section%> os-<%=@container_class_type%>-container" data-type="composite-page" data-uuid-key="<%= @uuid_key %>">
2
+ <<%= @main_title_tag %> data-type="<%= @in_composite_chapter ? 'title' : 'document-title' %>">
3
+ <span class="os-text"><%= @title %></span>
4
+ </<%= @main_title_tag %>>
5
+ <div data-type="metadata" style="display: none;">
6
+ <h1 data-type="document-title" itemprop="name"><%= @title %></h1>
7
+ <%= @metadata.paste %>
8
+ </div>
9
+ <%= @content %>
10
+ </div>
@@ -3,5 +3,5 @@
3
3
  # A library for modifying the structure of OpenStax book XML.
4
4
  #
5
5
  module Kitchen
6
- VERSION = '12.0.0'
6
+ VERSION = '14.0.0'
7
7
  end
data/lib/locales/en.yml CHANGED
@@ -27,6 +27,7 @@ en:
27
27
  section_exercises: ! 'Section %{number} Exercises'
28
28
  iframe_link_text: Click to view content
29
29
  handbook_outline_title: Outline
30
+ context_lead_text: 'Refer to '
30
31
  eoc:
31
32
  glossary: Key Terms
32
33
  key-equations: Key Equations
@@ -39,5 +40,8 @@ en:
39
40
  folio:
40
41
  preface: Preface
41
42
  access_for_free: Access for free at openstax.org
43
+ eob:
44
+ references: References
45
+ reference: References
42
46
  index:
43
47
  main: Index
data/lib/locales/es.yml CHANGED
@@ -35,5 +35,8 @@ es:
35
35
  folio:
36
36
  preface: Prefacio
37
37
  access_for_free: Acceso gratis en openstax.org
38
+ eob:
39
+ references: Referencias
40
+ reference: Referencias
38
41
  index:
39
42
  main: Índice
data/lib/locales/pl.yml CHANGED
@@ -67,6 +67,9 @@ pl:
67
67
  key-equations: Najważniejsze wzory
68
68
  summary: Podsumowanie
69
69
  references: Bibliografia
70
+ eob:
71
+ references: Bibliografia
72
+ reference: Bibliografia
70
73
  index:
71
74
  name: Skorowidz nazwisk
72
75
  term: Skorowidz rzeczowy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.0
4
+ version: 14.0.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: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -249,6 +249,7 @@ files:
249
249
  - lib/kitchen/directions/bake_appendix.rb
250
250
  - lib/kitchen/directions/bake_autotitled_exercise/main.rb
251
251
  - lib/kitchen/directions/bake_autotitled_exercise/v1.rb
252
+ - lib/kitchen/directions/bake_autotitled_exercise/v2.rb
252
253
  - lib/kitchen/directions/bake_chapter_glossary/main.rb
253
254
  - lib/kitchen/directions/bake_chapter_glossary/v1.rb
254
255
  - lib/kitchen/directions/bake_chapter_introductions/bake_chapter_objectives.rb
@@ -294,7 +295,8 @@ files:
294
295
  - lib/kitchen/directions/bake_index/v1.rb
295
296
  - lib/kitchen/directions/bake_index/v1.xhtml.erb
296
297
  - lib/kitchen/directions/bake_injected_exercise.rb
297
- - lib/kitchen/directions/bake_injected_exercise_question.rb
298
+ - lib/kitchen/directions/bake_injected_exercise/add_injected_exercise_id.rb
299
+ - lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise_question.rb
298
300
  - lib/kitchen/directions/bake_inline_lists.rb
299
301
  - lib/kitchen/directions/bake_learning_objectives.rb
300
302
  - lib/kitchen/directions/bake_link_placeholders.rb
@@ -302,6 +304,8 @@ files:
302
304
  - lib/kitchen/directions/bake_math_in_paragraph.rb
303
305
  - lib/kitchen/directions/bake_non_introduction_pages.rb
304
306
  - lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
307
+ - lib/kitchen/directions/bake_notes/bake_note_exercise.rb
308
+ - lib/kitchen/directions/bake_notes/bake_note_injected_question.rb
305
309
  - lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
306
310
  - lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb
307
311
  - lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb
@@ -319,6 +323,7 @@ files:
319
323
  - lib/kitchen/directions/bake_references/main.rb
320
324
  - lib/kitchen/directions/bake_references/v1.rb
321
325
  - lib/kitchen/directions/bake_references/v2.rb
326
+ - lib/kitchen/directions/bake_references/v3.rb
322
327
  - lib/kitchen/directions/bake_stepwise.rb
323
328
  - lib/kitchen/directions/bake_suggested_reading.rb
324
329
  - lib/kitchen/directions/bake_toc.rb
@@ -326,6 +331,7 @@ files:
326
331
  - lib/kitchen/directions/bake_unit_page_title/v1.rb
327
332
  - lib/kitchen/directions/bake_unit_title/main.rb
328
333
  - lib/kitchen/directions/bake_unit_title/v1.rb
334
+ - lib/kitchen/directions/bake_unnumbered_figure.rb
329
335
  - lib/kitchen/directions/bake_unnumbered_tables.rb
330
336
  - lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb
331
337
  - lib/kitchen/directions/book_answer_key_container/main.rb
@@ -333,8 +339,8 @@ files:
333
339
  - lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb
334
340
  - lib/kitchen/directions/chapter_review_container/main.rb
335
341
  - lib/kitchen/directions/chapter_review_container/v1.rb
336
- - lib/kitchen/directions/eoc_composite_page_container/main.rb
337
- - lib/kitchen/directions/eoc_composite_page_container/v1.rb
342
+ - lib/kitchen/directions/composite_page_container/main.rb
343
+ - lib/kitchen/directions/composite_page_container/v1.rb
338
344
  - lib/kitchen/directions/eoc_section_title_link_snippet.rb
339
345
  - lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
340
346
  - lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb
@@ -392,14 +398,16 @@ files:
392
398
  - lib/kitchen/references_element_enumerator.rb
393
399
  - lib/kitchen/search_history.rb
394
400
  - lib/kitchen/search_query.rb
401
+ - lib/kitchen/section_element.rb
402
+ - lib/kitchen/section_element_enumerator.rb
395
403
  - lib/kitchen/selector.rb
396
404
  - lib/kitchen/selectors/base.rb
397
405
  - lib/kitchen/selectors/standard_1.rb
398
406
  - lib/kitchen/solution_element_enumerator.rb
399
407
  - lib/kitchen/table_element.rb
400
408
  - lib/kitchen/table_element_enumerator.rb
409
+ - lib/kitchen/templates/composite_page_template.xhtml.erb
401
410
  - lib/kitchen/templates/eob_section_title_template.xhtml.erb
402
- - lib/kitchen/templates/eoc_section_template.xhtml.erb
403
411
  - lib/kitchen/templates/eoc_section_template_old.xhtml.erb
404
412
  - lib/kitchen/term_element.rb
405
413
  - lib/kitchen/term_element_enumerator.rb
@@ -461,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
461
469
  - !ruby/object:Gem::Version
462
470
  version: '0'
463
471
  requirements: []
464
- rubygems_version: 3.0.3
472
+ rubygems_version: 3.0.3.1
465
473
  signing_key:
466
474
  specification_version: 4
467
475
  summary: OpenStax content baking library
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kitchen::Directions::EocCompositePageContainer
4
- class V1
5
- renderable
6
-
7
- def bake(container_key:, uuid_key:, metadata_source:, content:, append_to:)
8
- @title = I18n.t(:"eoc.#{container_key}")
9
- @uuid_key = uuid_key
10
- @container_class_type = container_key
11
- @metadata = metadata_source.children_to_keep.copy
12
- @content = content
13
- @in_composite_chapter = append_to.is?(:composite_chapter)
14
-
15
- append_to.append(child: render(file:
16
- '../../templates/eoc_section_template.xhtml.erb'))
17
- end
18
- end
19
- end
@@ -1,11 +0,0 @@
1
- <% main_title_tag = @in_composite_chapter ? 'h3' : 'h2' %>
2
- <div class="os-eoc os-<%=@container_class_type%>-container" data-type="composite-page" data-uuid-key="<%= @uuid_key %>">
3
- <<%= main_title_tag %> data-type="<%= @in_composite_chapter ? 'title' : 'document-title' %>">
4
- <span class="os-text"><%= @title %></span>
5
- </<%= main_title_tag %>>
6
- <div data-type="metadata" style="display: none;">
7
- <h1 data-type="document-title" itemprop="name"><%= @title %></h1>
8
- <%= @metadata.paste %>
9
- </div>
10
- <%= @content %>
11
- </div>