openstax_kitchen 4.1.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/changelog.yml +24 -0
  3. data/.github/workflows/rubocop.yml +28 -0
  4. data/CHANGELOG.md +62 -0
  5. data/Gemfile.lock +16 -7
  6. data/docker/rubocop +24 -0
  7. data/lib/kitchen/composite_page_element.rb +20 -3
  8. data/lib/kitchen/directions/bake_appendix.rb +3 -1
  9. data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +23 -5
  10. data/lib/kitchen/directions/bake_chapter_introductions.rb +22 -15
  11. data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
  12. data/lib/kitchen/directions/bake_chapter_references/main.rb +1 -2
  13. data/lib/kitchen/directions/bake_chapter_references/v1.rb +26 -12
  14. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
  15. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
  16. data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
  17. data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
  18. data/lib/kitchen/directions/bake_chapter_summary.rb +13 -6
  19. data/lib/kitchen/directions/bake_example.rb +11 -2
  20. data/lib/kitchen/directions/bake_figure.rb +13 -0
  21. data/lib/kitchen/directions/bake_first_elements.rb +7 -1
  22. data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
  23. data/lib/kitchen/directions/bake_footnotes/v1.rb +11 -8
  24. data/lib/kitchen/directions/bake_further_research.rb +2 -0
  25. data/lib/kitchen/directions/bake_index/v1.rb +3 -14
  26. data/lib/kitchen/directions/bake_inline_lists.rb +22 -0
  27. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
  28. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
  29. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
  30. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
  31. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
  32. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +10 -1
  33. data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
  34. data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
  35. data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -24
  36. data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
  37. data/lib/kitchen/directions/bake_preface/main.rb +2 -2
  38. data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
  39. data/lib/kitchen/directions/bake_references/main.rb +7 -0
  40. data/lib/kitchen/directions/bake_references/v2.rb +35 -0
  41. data/lib/kitchen/directions/bake_toc.rb +3 -1
  42. data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
  43. data/lib/kitchen/directions/book_answer_key_container/main.rb +2 -2
  44. data/lib/kitchen/directions/book_answer_key_container/v1.rb +4 -3
  45. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +3 -3
  46. data/lib/kitchen/directions/chapter_review_container/main.rb +2 -2
  47. data/lib/kitchen/directions/chapter_review_container/v1.rb +4 -2
  48. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +13 -0
  49. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +10 -0
  50. data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
  51. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +6 -2
  52. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
  53. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
  54. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +11 -7
  55. data/lib/kitchen/document.rb +17 -42
  56. data/lib/kitchen/element_base.rb +31 -7
  57. data/lib/kitchen/i18n_string.rb +16 -0
  58. data/lib/kitchen/id_tracker.rb +68 -0
  59. data/lib/kitchen/oven.rb +3 -1
  60. data/lib/kitchen/page_element.rb +2 -3
  61. data/lib/kitchen/patches/array.rb +15 -0
  62. data/lib/kitchen/patches/i18n.rb +34 -0
  63. data/lib/kitchen/patches/integer.rb +24 -0
  64. data/lib/kitchen/patches/nokogiri.rb +7 -0
  65. data/lib/kitchen/version.rb +1 -1
  66. data/lib/locales/en.yml +2 -1
  67. data/lib/locales/es.yml +33 -0
  68. data/lib/locales/pl.yml +3 -1
  69. data/lib/openstax_kitchen.rb +2 -5
  70. data/openstax_kitchen.gemspec +1 -0
  71. metadata +40 -7
  72. data/.github/config.yml +0 -14
  73. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -51
  74. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +0 -9
  75. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +0 -19
  76. data/lib/kitchen/transliterations.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b80bf07271b311949246bf6a63a9d10fe5f14396175f66a129debcc9e9ef15e3
4
- data.tar.gz: 7a3a7050d134a0b106d3a80dc18add9209742fca1eea4873f351eb0dd4d05034
3
+ metadata.gz: 46fe1771e5853e9149dc1df841fafeaba3d3b157ab850d66f94745406867d901
4
+ data.tar.gz: 1f97e7a288fb5a9c7c96c3f9352238736ac9854a8b0a06379328253f89e9552f
5
5
  SHA512:
6
- metadata.gz: 7fee3b2b4dd92639af2e20520c3f65a31255d944df649e91c5c0e5c8f0a8e1e1f6d19b4477480c5cbc899f7124727c8a40b5a0759985ec94225885baf36b3287
7
- data.tar.gz: ed62932aa44e597135158cc182daefd2773b89070e1d82750669d4d1f760fa8179f1197c67eddcdec73c1cdc2b1bd7537ca28c8f5603d3a2a7962457d777141f
6
+ metadata.gz: d5a8b103ba036bd0db84ad87857873ff3f6c048c03951e6e5543577330df875025a97338c62b96f6278ca751be81a04be3e95ef6468458fed086e3bdad7adcc3
7
+ data.tar.gz: ff6c97185d2c264019fe041e17b83678c12f1f894bef9c0d11d01eab304b6a9c3200c2c9e03405267dc462a52775d78b44daa0050a9002ac1ea6bfef1998f111
@@ -0,0 +1,24 @@
1
+ name: CHANGELOG.md
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ exists:
8
+ timeout-minutes: 10
9
+ runs-on: ubuntu-18.04
10
+
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ with:
14
+ fetch-depth: 0
15
+ - name: Check for CHANGELOG.md in this PR
16
+ # https://dev.to/scienta/get-changed-files-in-github-actions-1p36
17
+ run: |
18
+ if [[ $(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep CHANGELOG.md) ]]; then
19
+ echo "CHANGELOG.md is included in the pull request! Way to go!"
20
+ exit 0
21
+ else
22
+ echo "CHANGELOG.md was not modified in this pull request. Boo!"
23
+ exit 1
24
+ fi
@@ -0,0 +1,28 @@
1
+ name: Rubocop
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ lint:
11
+ timeout-minutes: 10
12
+ runs-on: ubuntu-18.04
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ with:
17
+ fetch-depth: 0
18
+ - uses: actions/cache@v2
19
+ with:
20
+ path: vendor/bundle
21
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
22
+ restore-keys: |
23
+ ${{ runner.os }}-gems-
24
+ - name: Build docker image and run rubocop within it
25
+ # See https://docs.codecov.io/docs/testing-with-docker
26
+ run: |
27
+ ./docker/build --ci
28
+ ./docker/rubocop ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
data/CHANGELOG.md CHANGED
@@ -6,6 +6,68 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+
10
+ ## [8.0.0] - 2021-06-29
11
+
12
+ * Sort terms in `BakeChapterGlossary` in language specific way (major)
13
+ * Spanish translation change (minor)
14
+ * Fixed the implementation of `Element#wrap_children` to reuse existing document elements (major).
15
+
16
+ ## [7.0.0] - 2021-06-21
17
+
18
+ * Changed selector expected by `default strategy` in `move_solutions_to_answer_key` to optimize search (major)
19
+ * Fix Rubocop GitHub Action's regular expression used to select files to lint (patch)
20
+ * Add optional numbering to multiple solutions inside examples (minor)
21
+ * Added monkey patch for array to be able to add a prefix: `%w[multiple-choice true-false].prefix('section.')` (minor)
22
+ * Add more specific book part selector (`os-eob`) for References in `is_citation_reference?`, `is_section_reference?` methods in `Element Base` to fix toc selector for References which are moved to EoC (major)
23
+
24
+ ## [6.1.0] - 2021-06-21
25
+
26
+ * Create a `BakeReferences` V2 for unnumbered section references (minor)
27
+ * Don't check for CHANGELOG when merge a PR to main (patch)
28
+ * Added `BakeInlineLists` (minor)
29
+
30
+ ## [6.0.0] - 2021-06-15
31
+
32
+ * Allow `BakeChapterSummary` to skip pages where there is no summary (minor)
33
+ * Change `PageElement#summary` to return nil instead of raise an error if no matches (major?)
34
+ * Fix bug in `BakeNumberedNotes:::V3` when there are multiple os-numbers (minor)
35
+ * Add Rubocop and a working CHANGELOG check to GitHub actions (patch)
36
+ * Allow `BakeFootnotes` to number footnotes with Roman numerals (minor)
37
+ * Create V2 for `BakeNumberedTables` (minor)
38
+ * Remove extraneous title in `BakeChapterSectionExercises` (minor)
39
+ * Create V2 for `BookAnswerKeyContainer` and `MoveSolutionsToEOC` with singular option for wrapper class (minor)
40
+ * Delete `abstract` and `description` elements from preface in `BakePreface` (minor)
41
+ * Stop deleting the first `<strong>` tag in `BakeNumberedNotes` (major)
42
+ * Allow `BakeFigure` to bake unnumbered splash figures (minor)
43
+ * Extend `ChapterReviewContainer` to accept other classes (major?)
44
+ * Add a `Strategy` for Precalculus (minor)
45
+ * Create a `BakeNumberedNotes` V2 (minor)
46
+ * Added a version of `BakeChapterIntroductions` without a chapter outline (minor)
47
+ * Add `BakeChapterSolutions` which bakes the free response solutions at the eoc (minor)
48
+ * Changed locale `eoc_answer_key_title` to `answer_key_title` as it was only used in eob (major)
49
+ * Added spec for translations (minor)
50
+ * Remove summary attribute from numbered tables, add option to pass title element to `BakePreface` (minor)
51
+ * Renamed `American Government` strategy to `Default` inside `move_solutions_to_answer_key` for other books to use it with a sent in classname (major)
52
+ * Adds `#previous` method to note_elements to find the immediately previous element (minor)
53
+ * Adds `BakeNumberedNotes` V3 (minor)
54
+ * Added line that puts the classname `has-footnote` in the footnote ref's parent element (major)
55
+ * Added a condition into `BakeChapterSummary` so it doesn't bake the title if it already includes the respective number in it
56
+ * Create v3 of `MoveExercisesToEOC` which differs from v1 by the presence of a section title
57
+ and from v2 the lack of additional `os-section-area` and `os-#{@klass} wrapper` (minor)
58
+ * Add a condition in `BakeNumberedExercise` to make it possible to suppress even solutions in the Answer Key (minor)
59
+ * Fix `BakeFurtherResearch` baking with main bake script error by breaking the loop if further research sections are not present (minor)
60
+ * Rework v1 of `BakeChapterReferences` to bake references also from introduction pages (major)
61
+ * Fix for `BakeIndex` for words that start with a number to be grouped as symbols and for first letters with accent marks to be grouped with regular letters in alphabetic order (major)
62
+
63
+ ## [5.0.0] - 2021-06-02
64
+
65
+ * Reditributed duplicated id logic across `#record_id_copied`, `#record_id_cut`, `#record_id_pasted`, added a couple more tests for `#copy`, `#cut`, and `#paste`, created a new class `IdTracker` and moved `#record_id_copied`, `#record_id_cut`, `#record_id_pasted`, and `modified_id_to_paste` into the new class (major)
66
+ * Moved selectors from recipe to kitchen on `BakeFirstElements` Direction (minor)
67
+ * Auto-detect language based on document; force output encoding to UTF-8 (major)
68
+ * Switched to using a library to sort strings in a language-specific way (patch)
69
+ * Remove summary attribute from `BakeNumberedTable` (major)
70
+
9
71
  ## [4.1.1] - 2021-05-24
10
72
 
11
73
  * Adds low level Nokogiri caching, disabled by default (patch)
data/Gemfile.lock CHANGED
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (4.1.1)
4
+ openstax_kitchen (8.0.0)
5
5
  activesupport
6
6
  i18n
7
7
  nokogiri
8
8
  rainbow
9
+ twitter_cldr
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activesupport (6.1.3.2)
14
+ activesupport (6.1.4)
14
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
16
  i18n (>= 1.6, < 2)
16
17
  minitest (>= 5.1)
@@ -18,12 +19,14 @@ GEM
18
19
  zeitwerk (~> 2.3)
19
20
  ast (2.4.1)
20
21
  byebug (11.1.2)
21
- codecov (0.2.13)
22
- simplecov (~> 0.18.0)
22
+ camertron-eprun (1.1.1)
23
+ cldr-plurals-runtime-rb (1.1.0)
24
+ codecov (0.5.2)
25
+ simplecov (>= 0.15, < 0.22)
23
26
  coderay (1.1.3)
24
- concurrent-ruby (1.1.8)
27
+ concurrent-ruby (1.1.9)
25
28
  diff-lcs (1.3)
26
- docile (1.3.3)
29
+ docile (1.4.0)
27
30
  i18n (1.8.10)
28
31
  concurrent-ruby (~> 1.0)
29
32
  inch (0.8.0)
@@ -83,10 +86,12 @@ GEM
83
86
  rubocop (~> 1.0)
84
87
  rubocop-ast (>= 1.1.0)
85
88
  ruby-progressbar (1.10.1)
86
- simplecov (0.18.5)
89
+ simplecov (0.21.2)
87
90
  docile (~> 1.1)
88
91
  simplecov-html (~> 0.11)
92
+ simplecov_json_formatter (~> 0.1)
89
93
  simplecov-html (0.12.3)
94
+ simplecov_json_formatter (0.1.3)
90
95
  sparkr (0.4.1)
91
96
  sync (0.5.0)
92
97
  tdiff (0.3.4)
@@ -94,6 +99,10 @@ GEM
94
99
  tins (~> 1.0)
95
100
  tins (1.26.0)
96
101
  sync
102
+ twitter_cldr (6.6.0)
103
+ camertron-eprun
104
+ cldr-plurals-runtime-rb (~> 1.1)
105
+ tzinfo
97
106
  tzinfo (2.0.4)
98
107
  concurrent-ruby (~> 1.0)
99
108
  unicode-display_width (1.7.0)
data/docker/rubocop ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # set -x
4
+
5
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6
+
7
+ commit_range="${1:-main}"
8
+ if [ ! -z "$2" ]; then
9
+ commit_range="$commit_range..$2"
10
+ fi
11
+
12
+ echo "Checking $commit_range"
13
+
14
+ # https://dev.to/scienta/get-changed-files-in-github-actions-1p36
15
+ changed_ruby_files=$(git diff --name-only --diff-filter=ACMRT $commit_range | grep -E "(lib\/|spec\/).*\.rb$" | xargs)
16
+
17
+ if [[ -z "${changed_ruby_files// }" ]]; then
18
+ echo "No files to lint with Rubocop"
19
+ else
20
+ docker run -v $DIR/..:/code \
21
+ -w /code \
22
+ openstax/kitchen.ci:latest \
23
+ /bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rubocop $changed_ruby_files --disable-pending-cops"
24
+ fi
@@ -43,12 +43,29 @@ module Kitchen
43
43
  has_class?('os-index-container')
44
44
  end
45
45
 
46
- # Returns true if this page is a book reference
46
+ # In books we can find two types of EOB References.
47
+ #
48
+ # One of them has form similar to footnotes. There are citation links in the text that provides
49
+ # to the reference note at the end of the book.
50
+ #
51
+ # Second one is a section with references on the Introduction page that is moved to the EOB.
52
+ #
53
+ # Difference in classes is important.
54
+
55
+ # Returns true if this page is a book citation reference
56
+ #
57
+ # @return [Boolean]
58
+ #
59
+ def is_citation_reference?
60
+ has_class?('os-eob os-reference-container')
61
+ end
62
+
63
+ # Returns true if this page is a book section reference
47
64
  #
48
65
  # @return [Boolean]
49
66
  #
50
- def is_reference?
51
- has_class?('os-reference-container')
67
+ def is_section_reference?
68
+ has_class?('os-eob os-references-container')
52
69
  end
53
70
 
54
71
  end
@@ -17,7 +17,9 @@ module Kitchen
17
17
 
18
18
  # Make a section with data-depth of X have a header level of X+1
19
19
  page.search('section').each do |section|
20
- title = section.first!("[data-type='title']")
20
+ title = section.titles.first
21
+ next unless title.present?
22
+
21
23
  title.name = "h#{section['data-depth'].to_i + 1}"
22
24
  end
23
25
  end
@@ -4,21 +4,39 @@ module Kitchen::Directions::BakeChapterGlossary
4
4
  class V1
5
5
  renderable
6
6
 
7
+ class Definition
8
+ attr_reader :element
9
+
10
+ def initialize(element)
11
+ term = Kitchen::I18nString.new(element.first('dt').text.downcase)
12
+ description = Kitchen::I18nString.new(element.first('dd').text.downcase)
13
+ @sortable = [term, description]
14
+ @element = element
15
+ end
16
+
17
+ def <=>(other)
18
+ sortable <=> other.sortable
19
+ end
20
+
21
+ protected
22
+
23
+ attr_reader :sortable
24
+ end
25
+
7
26
  def bake(chapter:, metadata_source:, append_to: nil, uuid_prefix: '')
8
27
  @metadata = metadata_source.children_to_keep.copy
9
28
  @klass = 'glossary'
10
29
  @title = I18n.t(:eoc_key_terms_title)
11
30
  @uuid_prefix = uuid_prefix
31
+ @glossary = []
12
32
 
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]
33
+ chapter.glossaries.search('dl').each do |definition_element|
34
+ @glossary.push(Definition.new(definition_element.cut))
17
35
  end
18
36
 
19
37
  chapter.glossaries.trash
20
38
 
21
- @content = definitions.paste
39
+ @content = @glossary.sort.map { |definition| definition.element.paste }.join
22
40
 
23
41
  append_to_element = append_to || chapter
24
42
  @in_composite_chapter = append_to_element.is?(:composite_chapter)
@@ -3,21 +3,31 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeChapterIntroductions
6
- def self.v1(book:)
6
+ def self.v1(book:, bake_chapter_objectives: true)
7
7
  book.chapters.each do |chapter|
8
- outline_items_html = chapter.pages.map do |page|
9
- next if page.is_introduction?
8
+ chapter_outline_html = ''
10
9
 
11
- <<~HTML
12
- <div class="os-chapter-objective">
13
- <a class="os-chapter-objective" href="##{page.title[:id]}">
14
- <span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter) - 1}</span>
15
- <span class="os-divider"> </span>
16
- <span data-type="" itemprop="" class="os-text">#{page.title.children[0].text}</span>
17
- </a>
10
+ if bake_chapter_objectives
11
+ outline_items_html = chapter.non_introduction_pages.map do |page|
12
+
13
+ <<~HTML
14
+ <div class="os-chapter-objective">
15
+ <a class="os-chapter-objective" href="##{page.title[:id]}">
16
+ <span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter)}</span>
17
+ <span class="os-divider"> </span>
18
+ <span data-type="" itemprop="" class="os-text">#{page.title.children[0].text}</span>
19
+ </a>
20
+ </div>
21
+ HTML
22
+ end.join('')
23
+
24
+ chapter_outline_html = <<~HTML
25
+ <div class="os-chapter-outline">
26
+ <h3 class="os-title">#{I18n.t(:chapter_outline)}</h3>
27
+ #{outline_items_html}
18
28
  </div>
19
29
  HTML
20
- end.join('')
30
+ end
21
31
 
22
32
  introduction_page = chapter.introduction_page
23
33
 
@@ -33,10 +43,7 @@ module Kitchen
33
43
  introduction_page.append(child:
34
44
  <<~HTML
35
45
  <div class="intro-body">
36
- <div class="os-chapter-outline">
37
- <h3 class="os-title">#{I18n.t(:chapter_outline)}</h3>
38
- #{outline_items_html}
39
- </div>
46
+ #{chapter_outline_html}
40
47
  <div class="intro-text">
41
48
  #{title.paste}
42
49
  #{intro_content.paste}
@@ -8,8 +8,7 @@ module Kitchen
8
8
  chapter: chapter,
9
9
  metadata_source: metadata_source,
10
10
  uuid_prefix: uuid_prefix,
11
- klass: klass
12
- )
11
+ klass: klass)
13
12
  end
14
13
  end
15
14
  end
@@ -12,24 +12,38 @@ module Kitchen::Directions::BakeChapterReferences
12
12
 
13
13
  chapter.references.search('h3').trash
14
14
 
15
- chapter.non_introduction_pages.each do |page|
16
- references = page.references
17
- next if references.none?
18
-
19
- references.search('h3').trash
20
- title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: page)
15
+ bake_page_references(page: chapter.introduction_page)
21
16
 
22
- references.each do |reference|
23
- reference.prepend(child: title)
24
- end
17
+ chapter.non_introduction_pages.each do |page|
18
+ bake_page_references(page: page)
25
19
  end
26
20
 
27
21
  @content = chapter.pages.references.cut.paste
28
-
29
- @in_composite_chapter = false
30
-
31
22
  chapter.append(child: render(file:
32
23
  '../../templates/eoc_section_title_template.xhtml.erb'))
33
24
  end
25
+
26
+ def bake_page_references(page:)
27
+ return if page.nil?
28
+
29
+ references = page.references
30
+ return if references.none?
31
+
32
+ title = if page.is_introduction?
33
+ <<~HTML
34
+ <a href="##{page.title.id}">
35
+ <h3 data-type="document-title" id="#{page.title.copied_id}">
36
+ <span class="os-text" data-type="" itemprop="">#{page.title_text}</span>
37
+ </h3>
38
+ </a>
39
+ HTML
40
+ else
41
+ Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: page)
42
+ end
43
+
44
+ references.each do |reference|
45
+ reference.prepend(child: title)
46
+ end
47
+ end
34
48
  end
35
49
  end
@@ -3,8 +3,8 @@
3
3
  module Kitchen
4
4
  module Directions
5
5
  module BakeChapterSectionExercises
6
- def self.v1(chapter:)
7
- V1.new.bake(chapter: chapter)
6
+ def self.v1(chapter:, trash_title: false)
7
+ V1.new.bake(chapter: chapter, trash_title: trash_title)
8
8
  end
9
9
  end
10
10
  end