openstax_kitchen 3.2.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.md +42 -1
  4. data/Gemfile.lock +13 -14
  5. data/docker/ci +0 -1
  6. data/lib/kitchen/book_element.rb +16 -2
  7. data/lib/kitchen/chapter_element.rb +8 -11
  8. data/lib/kitchen/chapter_element_enumerator.rb +1 -1
  9. data/lib/kitchen/composite_chapter_element.rb +7 -11
  10. data/lib/kitchen/composite_page_element.rb +15 -10
  11. data/lib/kitchen/composite_page_element_enumerator.rb +1 -1
  12. data/lib/kitchen/config.rb +7 -0
  13. data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
  14. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
  15. data/lib/kitchen/directions/bake_chapter_introductions.rb +1 -1
  16. data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +7 -2
  17. data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +12 -7
  18. data/lib/kitchen/directions/bake_chapter_key_equations.rb +26 -21
  19. data/lib/kitchen/directions/bake_chapter_summary.rb +48 -42
  20. data/lib/kitchen/directions/bake_equations.rb +1 -1
  21. data/lib/kitchen/directions/bake_example.rb +5 -1
  22. data/lib/kitchen/directions/bake_figure.rb +1 -1
  23. data/lib/kitchen/directions/{bake_problem_first_elements.rb → bake_first_elements.rb} +2 -2
  24. data/lib/kitchen/directions/bake_footnotes/v1.rb +2 -1
  25. data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
  26. data/lib/kitchen/directions/bake_free_response/main.rb +11 -0
  27. data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
  28. data/lib/kitchen/directions/bake_further_research.rb +59 -0
  29. data/lib/kitchen/directions/bake_index/v1.rb +35 -14
  30. data/lib/kitchen/directions/bake_link_placeholders.rb +1 -1
  31. data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +4 -0
  32. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +9 -21
  33. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +6 -2
  34. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +25 -12
  35. data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -1
  36. data/lib/kitchen/directions/bake_page_abstracts.rb +1 -1
  37. data/lib/kitchen/directions/bake_references/main.rb +16 -0
  38. data/lib/kitchen/directions/bake_references/v1.rb +48 -0
  39. data/lib/kitchen/directions/bake_suggested_reading.rb +5 -0
  40. data/lib/kitchen/directions/bake_toc.rb +4 -2
  41. data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/eob_solutions_container.xhtml.erb +0 -0
  42. data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/main.rb +1 -1
  43. data/lib/kitchen/directions/{bake_book_answer_key → book_answer_key_container}/v1.rb +1 -1
  44. data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/chapter_review.xhtml.erb +0 -0
  45. data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/main.rb +1 -1
  46. data/lib/kitchen/directions/{bake_chapter_review → chapter_review_container}/v1.rb +1 -1
  47. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +1 -1
  48. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +27 -0
  49. data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v1.rb +8 -10
  50. data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v2.rb +8 -9
  51. data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/main.rb +1 -1
  52. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +19 -0
  53. data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/calculus.rb +1 -1
  54. data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/uphysics.rb +5 -3
  55. data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/v1.rb +3 -1
  56. data/lib/kitchen/document.rb +11 -0
  57. data/lib/kitchen/element.rb +9 -3
  58. data/lib/kitchen/element_base.rb +61 -10
  59. data/lib/kitchen/element_enumerator_base.rb +9 -1
  60. data/lib/kitchen/element_enumerator_factory.rb +9 -5
  61. data/lib/kitchen/element_factory.rb +3 -3
  62. data/lib/kitchen/example_element.rb +8 -11
  63. data/lib/kitchen/example_element_enumerator.rb +1 -1
  64. data/lib/kitchen/exercise_element.rb +5 -8
  65. data/lib/kitchen/exercise_element_enumerator.rb +1 -1
  66. data/lib/kitchen/figure_element.rb +8 -11
  67. data/lib/kitchen/figure_element_enumerator.rb +1 -1
  68. data/lib/kitchen/metadata_element.rb +8 -2
  69. data/lib/kitchen/metadata_element_enumerator.rb +1 -1
  70. data/lib/kitchen/note_element.rb +8 -11
  71. data/lib/kitchen/note_element_enumerator.rb +1 -1
  72. data/lib/kitchen/page_element.rb +20 -7
  73. data/lib/kitchen/page_element_enumerator.rb +1 -1
  74. data/lib/kitchen/reference_element.rb +27 -0
  75. data/lib/kitchen/references_element_enumerator.rb +20 -0
  76. data/lib/kitchen/search_query.rb +25 -3
  77. data/lib/kitchen/selector.rb +24 -0
  78. data/lib/kitchen/selectors/base.rb +39 -0
  79. data/lib/kitchen/selectors/standard_1.rb +13 -0
  80. data/lib/kitchen/table_element.rb +8 -11
  81. data/lib/kitchen/table_element_enumerator.rb +1 -1
  82. data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
  83. data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
  84. data/lib/kitchen/term_element.rb +5 -8
  85. data/lib/kitchen/term_element_enumerator.rb +1 -1
  86. data/lib/kitchen/unit_element.rb +13 -7
  87. data/lib/kitchen/unit_element_enumerator.rb +1 -1
  88. data/lib/kitchen/version.rb +1 -1
  89. data/lib/locales/en.yml +3 -0
  90. data/lib/openstax_kitchen.rb +1 -0
  91. metadata +30 -22
  92. data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -39
  93. data/lib/kitchen/directions/bake_chapter_key_concepts/key_concepts.xhtml.erb +0 -16
  94. data/lib/kitchen/directions/bake_chapter_review_exercises/main.rb +0 -15
  95. data/lib/kitchen/directions/bake_chapter_review_exercises/review_exercises.xhtml.erb +0 -10
  96. data/lib/kitchen/directions/bake_exercises/main.rb +0 -12
  97. data/lib/kitchen/directions/bake_exercises/v1.rb +0 -169
  98. data/lib/kitchen/directions/bake_notes/bake_notes.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e855f5598f3d3a425d670a828131a25605935b01ce0de9c38cceea7bb27703f
4
- data.tar.gz: 50b1a58be988e539a031390ee7387a1249a1ddcdc2734c3b9a0d9c9dfa43b426
3
+ metadata.gz: a6855dd0e84e96799a57645b9023db15a07400c5b6971a0ebb29edf5c87074f0
4
+ data.tar.gz: e7106c5faa811f73e25a829258a4aadfccad20c32dc2a0623ec8a2526e44d274
5
5
  SHA512:
6
- metadata.gz: 844384ec30da9c49e15026d1e5604e7248ef3a2806bbd242be398a04d6d8bddb8924225036dc3f4cfd0a0033fa27fa0bb975768317ddae012684bcf01e5b7483
7
- data.tar.gz: 3f68410be5d1f0e7b06a8f8b618f44cd022a35d6e5ab6ce76a785eb5f702cd22ef2312cba218d8d0fb0628ce13d04cffc023fc647bee16c6ebe6ab566c2f862e
6
+ metadata.gz: 792c85c2b914719e38cca37b798160353425a6f80074926ead34c03e5fd97e47167dbc7d3efcef30d43a459a3ad917fd2e2e354fe490053e4345775cb7eac4df
7
+ data.tar.gz: 95d4ec07de107850a81cec9a714e5dbe83835dd1536005587109292f503d8afa9a1bdc896dc43f3198d59f18769ef7ab4c9ae2ee312d047ab8bee9997cc4c0a6
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
@@ -17,4 +18,3 @@ tutorial/outputs/*.html
17
18
 
18
19
  tutorials/**/actual_baked.*html
19
20
  tutorials/**/my_recipe.rb
20
-
data/CHANGELOG.md CHANGED
@@ -6,8 +6,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [3.2.0] - 2021-04-19
9
+ ## [4.0.0] - 2021-05-18
10
10
 
11
+ * Changes `default_css_or_xpath` to optionally be a proc to be evaluated w.r.t. a document's config (minor)
12
+ * Support namespaces defined on elements other than the root (minor)
13
+ * Non-splash figures now treated like normal intro-body content in `BakeChapterIntroductions`
14
+ * `BakeNumberedNotes` and the uphysics strategy for `MoveSolutionsToAnswerKey` updated to accomodate multiple exercises in a note.
15
+ * `BakeFootnotes` now looks for footnotes in composite chapters
16
+ * Move exercise pantry label storage to `BakeNumberedExercises` to ensure consistency between exercise number and link text
17
+ * Update `BakeIndex` term capitalization handling to be less case sensitive (minor)
18
+ * Added a title tag variable to choose between h2 and h3 for children of chapter review (minor)
19
+ * Added a fix for examples not to bake table captions (minor)
20
+ * Replaced a .text with .children to include math text (minor)
21
+ * Changed title tag on numbered notes to always be h3 (major)
22
+ * Storing all note subtitles in the pantry for link placeholders (minor)
23
+ * Added another xmlns string option to remove if clone (minor)
24
+ * Add class to reference superscript & add metadata to `BakeSuggestedReading` (minor)
25
+ * Add `BakeFreeResponse` Directions (minor)
26
+ * Add terms from composite pages to index (minor)
27
+ * Access `.pantry` and `.clipboard` through an element instead of just its document (minor)
28
+ * Add `suppress_solution` option to `BakeNumberedExercise` (minor)
29
+ * Add strategy for American Government answer key (minor)
30
+ * Add `BakeReferences` direction (minor)
31
+ * Fix xmlns string replacement done in PR #209 (minor)
32
+ * Move title above metadata in `BakeSuggestedReading` direction (major)
33
+ * Remove depreciated directions `BakeNotes` and `BakeExercises` (major)
34
+ * Adds `eoc_composite_metadata_title` to en.yml and eoc template (major)
35
+ * Add `template` folder to kitchen to hold templates (minor)
36
+ * Add `eoc_section_title_template` (minor)
37
+ * Expand specs with `append_to` to have with/without `append_to` contexts (minor)
38
+ * Add `is?` method to `ElementBase` (minor)
39
+ * Replaced in_composite_chapter to use `is?` (minor)
40
+ * Add callable `short_type` to Elements (minor)
41
+ * Add template for eob titles - `eob_section_title_template` (minor)
42
+
43
+ ## [3.2.0] - 2021-04-20
44
+
45
+ * Adds method to allow unit and page title text to be retrieved regardless of bake status (minor)
46
+ * Rename several directions (major)
47
+ * `BakeChapterReviewExercises` -> `MoveExercisesToEOC`
48
+ * `BakeChapterReview` -> `ChapterReviewContainer`
49
+ * `BakeBookAnswerKey` -> `BookAnswerKeyContainer`
50
+ * `BakeChapterAnswerKey` -> `MoveSolutionsToAnswerKey`
51
+ * Refactors `BakeFirstElements` and `BakeNumberedExercise` (minor)
11
52
  * Adds a decorating option of equation numbers on `BakeEquations` (minor)
12
53
 
13
54
  ## [3.1.0] - 2021-04-19
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (3.2.0)
4
+ openstax_kitchen (4.0.0)
5
5
  activesupport
6
6
  i18n
7
7
  nokogiri
@@ -10,21 +10,21 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.0.3.3)
13
+ activesupport (6.1.3.2)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
18
- zeitwerk (~> 2.2, >= 2.2.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ zeitwerk (~> 2.3)
19
19
  ast (2.4.1)
20
20
  byebug (11.1.2)
21
21
  codecov (0.2.13)
22
22
  simplecov (~> 0.18.0)
23
23
  coderay (1.1.3)
24
- concurrent-ruby (1.1.7)
24
+ concurrent-ruby (1.1.8)
25
25
  diff-lcs (1.3)
26
26
  docile (1.3.3)
27
- i18n (1.8.5)
27
+ i18n (1.8.10)
28
28
  concurrent-ruby (~> 1.0)
29
29
  inch (0.8.0)
30
30
  pry
@@ -33,7 +33,7 @@ GEM
33
33
  yard (~> 0.9.12)
34
34
  method_source (1.0.0)
35
35
  mini_portile2 (2.5.0)
36
- minitest (5.14.2)
36
+ minitest (5.14.4)
37
37
  nokogiri (1.11.1)
38
38
  mini_portile2 (~> 2.5.0)
39
39
  racc (~> 1.4)
@@ -52,7 +52,7 @@ GEM
52
52
  rainbow (3.0.0)
53
53
  rake (12.3.3)
54
54
  regexp_parser (2.0.1)
55
- rexml (3.2.4)
55
+ rexml (3.2.5)
56
56
  rspec (3.9.0)
57
57
  rspec-core (~> 3.9.0)
58
58
  rspec-expectations (~> 3.9.0)
@@ -92,14 +92,13 @@ GEM
92
92
  tdiff (0.3.4)
93
93
  term-ansicolor (1.7.1)
94
94
  tins (~> 1.0)
95
- thread_safe (0.3.6)
96
95
  tins (1.26.0)
97
96
  sync
98
- tzinfo (1.2.7)
99
- thread_safe (~> 0.1)
97
+ tzinfo (2.0.4)
98
+ concurrent-ruby (~> 1.0)
100
99
  unicode-display_width (1.7.0)
101
100
  yard (0.9.24)
102
- zeitwerk (2.4.0)
101
+ zeitwerk (2.4.2)
103
102
 
104
103
  PLATFORMS
105
104
  ruby
data/docker/ci CHANGED
@@ -10,7 +10,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
10
10
  docker run $CI_ENV \
11
11
  -e ENABLE_CODECOV=1 -e CI=true \
12
12
  -v $DIR/..:/code \
13
- -v vendor/bundle \
14
13
  -w /code \
15
14
  openstax/kitchen.ci:latest \
16
15
  /bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rspec"
@@ -13,8 +13,14 @@ module Kitchen
13
13
  def initialize(node:, document: nil)
14
14
  super(node: node,
15
15
  document: document,
16
- enumerator_class: BookElementEnumerator,
17
- short_type: :book)
16
+ enumerator_class: BookElementEnumerator)
17
+ end
18
+
19
+ # Returns the short type
20
+ # @return [Symbol]
21
+ #
22
+ def self.short_type
23
+ :book
18
24
  end
19
25
 
20
26
  # Returns the "body" element
@@ -41,5 +47,13 @@ module Kitchen
41
47
  first!('nav#toc')
42
48
  end
43
49
 
50
+ # Returns true if this class represents the element for the given node
51
+ #
52
+ # @param node [Nokogiri::XML::Node] the underlying node
53
+ # @return [Boolean]
54
+ #
55
+ def self.is_the_element_class_for?(node, **)
56
+ node.name == 'body'
57
+ end
44
58
  end
45
59
  end
@@ -13,8 +13,14 @@ module Kitchen
13
13
  def initialize(node:, document: nil)
14
14
  super(node: node,
15
15
  document: document,
16
- enumerator_class: ChapterElementEnumerator,
17
- short_type: :chapter)
16
+ enumerator_class: ChapterElementEnumerator)
17
+ end
18
+
19
+ # Returns the short type
20
+ # @return [Symbol]
21
+ #
22
+ def self.short_type
23
+ :chapter
18
24
  end
19
25
 
20
26
  # Returns the title element (the one in the immediate children, not the one in the metadata)
@@ -62,14 +68,5 @@ module Kitchen
62
68
  search('[data-type="abstract"]')
63
69
  end
64
70
 
65
- # Returns true if this class represents the element for the given node
66
- #
67
- # @param node [Nokogiri::XML::Node] the underlying node
68
- # @return [Boolean]
69
- #
70
- def self.is_the_element_class_for?(node)
71
- node['data-type'] == 'chapter'
72
- end
73
-
74
71
  end
75
72
  end
@@ -11,7 +11,7 @@ module Kitchen
11
11
  #
12
12
  def self.factory
13
13
  ElementEnumeratorFactory.new(
14
- default_css_or_xpath: "div[data-type='chapter']", # TODO: element.document.selectors.chapter
14
+ default_css_or_xpath: Selector.named(:chapter),
15
15
  sub_element_class: ChapterElement,
16
16
  enumerator_class: self
17
17
  )
@@ -13,8 +13,13 @@ module Kitchen
13
13
  def initialize(node:, document: nil)
14
14
  super(node: node,
15
15
  document: document,
16
- enumerator_class: ElementEnumerator,
17
- short_type: :composite_chapter)
16
+ enumerator_class: ElementEnumerator)
17
+ end
18
+
19
+ # Returns short type
20
+ #
21
+ def self.short_type
22
+ :composite_chapter
18
23
  end
19
24
 
20
25
  # Returns the title element (the one in the immediate children, not the one in the metadata)
@@ -29,14 +34,5 @@ module Kitchen
29
34
  first!("./*[@data-type = 'document-title']")
30
35
  end
31
36
 
32
- # Returns true if this class represents the element for the given node
33
- #
34
- # @param node [Nokogiri::XML::Node] the underlying node
35
- # @return [Boolean]
36
- #
37
- def self.is_the_element_class_for?(node)
38
- node['data-type'] == 'composite-chapter'
39
- end
40
-
41
37
  end
42
38
  end
@@ -13,8 +13,14 @@ module Kitchen
13
13
  def initialize(node:, document: nil)
14
14
  super(node: node,
15
15
  document: document,
16
- enumerator_class: CompositePageElementEnumerator,
17
- short_type: :composite_page)
16
+ enumerator_class: CompositePageElementEnumerator)
17
+ end
18
+
19
+ # Returns the short type
20
+ # @return [Symbol]
21
+ #
22
+ def self.short_type
23
+ :composite_page
18
24
  end
19
25
 
20
26
  # Returns the title element (the one in the immediate children, not the one in the metadata)
@@ -26,24 +32,23 @@ module Kitchen
26
32
  # Get the title in the immediate children, not the one in the metadata. Could use
27
33
  # CSS of ":not([data-type='metadata']) > [data-type='document-title'], [data-type='document-title']"
28
34
  # but xpath is shorter
29
- first!("./*[@data-type = 'document-title']")
35
+ first!("./*[@data-type = 'document-title' or @data-type = 'title']")
30
36
  end
31
37
 
32
- # Returns true if this class represents the element for the given node
38
+ # Returns true if this page is a book index
33
39
  #
34
- # @param node [Nokogiri::XML::Node] the underlying node
35
40
  # @return [Boolean]
36
41
  #
37
- def self.is_the_element_class_for?(node)
38
- node['data-type'] == 'composite-page'
42
+ def is_index?
43
+ has_class?('os-index-container')
39
44
  end
40
45
 
41
- # Returns true if this page is a book index
46
+ # Returns true if this page is a book reference
42
47
  #
43
48
  # @return [Boolean]
44
49
  #
45
- def is_index?
46
- has_class?('os-index-container')
50
+ def is_reference?
51
+ has_class?('os-reference-container')
47
52
  end
48
53
 
49
54
  end
@@ -11,7 +11,7 @@ module Kitchen
11
11
  #
12
12
  def self.factory
13
13
  ElementEnumeratorFactory.new(
14
- default_css_or_xpath: "div[data-type='composite-page']",
14
+ default_css_or_xpath: Selector.named(:composite_page),
15
15
  sub_element_class: CompositePageElement,
16
16
  enumerator_class: self
17
17
  )
@@ -11,6 +11,12 @@ module Kitchen
11
11
  #
12
12
  attr_reader :selectors
13
13
 
14
+ # @!attribute [rw] enable_all_namespaces
15
+ #
16
+ # @return [Boolean]
17
+ #
18
+ attr_accessor :enable_all_namespaces
19
+
14
20
  # Creates a new config from a file (not implemented)
15
21
  #
16
22
  def self.new_from_file(_file)
@@ -21,6 +27,7 @@ module Kitchen
21
27
  #
22
28
  def initialize(hash: {}, selectors: nil)
23
29
  @selectors = selectors || Kitchen::Selectors::Standard1.new
30
+ @enable_all_namespaces = hash[:enable_all_namespaces] || true
24
31
  @hash = hash
25
32
  end
26
33
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ # Bake directons for eoc glossary
6
+ #
7
+ module BakeChapterGlossary
8
+ def self.v1(chapter:, metadata_source:, append_to: nil, uuid_prefix: nil)
9
+ V1.new.bake(
10
+ chapter: chapter,
11
+ metadata_source: metadata_source,
12
+ append_to: append_to,
13
+ uuid_prefix: uuid_prefix
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen::Directions::BakeChapterGlossary
4
+ class V1
5
+ renderable
6
+
7
+ def bake(chapter:, metadata_source:, append_to: nil, uuid_prefix: '')
8
+ @metadata = metadata_source.children_to_keep.copy
9
+ @klass = 'glossary'
10
+ @title = I18n.t(:eoc_key_terms_title)
11
+ @uuid_prefix = uuid_prefix
12
+
13
+ definitions = chapter.glossaries.search('dl').cut
14
+ return if definitions.none?
15
+ definitions.sort_by! do |definition|
16
+ [definition.first('dt').text.downcase, definition.first('dd').text.downcase]
17
+ end
18
+
19
+ chapter.glossaries.trash
20
+
21
+ @content = definitions.paste
22
+
23
+ append_to_element = append_to || chapter
24
+ @in_composite_chapter = append_to_element.is?(:composite_chapter)
25
+
26
+ append_to_element.append(child: render(file:
27
+ '../../templates/eoc_section_title_template.xhtml.erb'))
28
+ end
29
+ end
30
+ end
@@ -28,7 +28,7 @@ module Kitchen
28
28
  title.name = 'h2'
29
29
  MoveTitleTextIntoSpan.v1(title: title)
30
30
 
31
- intro_content = introduction_page.search("> :not([data-type='metadata']):not(figure)").cut
31
+ intro_content = introduction_page.search("> :not([data-type='metadata']):not(.splash):not(.has-splash)").cut
32
32
 
33
33
  introduction_page.append(child:
34
34
  <<~HTML
@@ -3,8 +3,13 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeChapterKeyConcepts
6
- def self.v1(chapter:, metadata_source:, append_to: nil)
7
- V1.new.bake(chapter: chapter, metadata_source: metadata_source, append_to: append_to)
6
+ def self.v1(chapter:, metadata_source:, append_to: nil, uuid_prefix: '.')
7
+ V1.new.bake(
8
+ chapter: chapter,
9
+ metadata_source: metadata_source,
10
+ append_to: append_to,
11
+ uuid_prefix: uuid_prefix
12
+ )
8
13
  end
9
14
  end
10
15
  end
@@ -3,10 +3,12 @@
3
3
  module Kitchen::Directions::BakeChapterKeyConcepts
4
4
  class V1
5
5
  renderable
6
- def bake(chapter:, metadata_source:, append_to:)
7
- @metadata_elements = metadata_source.children_to_keep.copy
6
+ def bake(chapter:, metadata_source:, append_to:, uuid_prefix:)
7
+ @metadata = metadata_source.children_to_keep.copy
8
+ @klass = 'key-concepts'
9
+ @title = I18n.t(:eoc_key_concepts)
10
+ @uuid_prefix = uuid_prefix
8
11
 
9
- @key_concepts = []
10
12
  key_concepts_clipboard = Kitchen::Clipboard.new
11
13
  chapter.non_introduction_pages.each do |page|
12
14
  key_concepts = page.key_concepts
@@ -16,15 +18,18 @@ module Kitchen::Directions::BakeChapterKeyConcepts
16
18
  title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: page)
17
19
  key_concepts.each do |key_concept|
18
20
  key_concept.prepend(child: title)
19
- key_concept&.cut(to: key_concepts_clipboard)
21
+ key_concept.wrap("<div class='os-section-area'>")
22
+ page.search('.os-section-area').first.cut(to: key_concepts_clipboard)
20
23
  end
21
- @key_concepts.push(key_concepts_clipboard.paste)
22
- key_concepts_clipboard.clear
23
24
  end
24
25
 
26
+ @content = "<div class=\"os-key-concepts\"> #{key_concepts_clipboard.paste} </div>"
27
+
25
28
  append_to_element = append_to || chapter
29
+ @in_composite_chapter = append_to_element.is?(:composite_chapter)
26
30
 
27
- append_to_element.append(child: render(file: 'key_concepts.xhtml.erb'))
31
+ append_to_element.append(child: render(file:
32
+ '../../templates/eoc_section_title_template.xhtml.erb'))
28
33
  end
29
34
  end
30
35
  end