openstax_kitchen 4.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) 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 +58 -0
  5. data/Gemfile.lock +15 -6
  6. data/README.md +16 -0
  7. data/codecov.yaml +1 -0
  8. data/docker/rubocop +22 -0
  9. data/lib/kitchen/book_document.rb +1 -1
  10. data/lib/kitchen/chapter_element.rb +2 -2
  11. data/lib/kitchen/composite_chapter_element_enumerator.rb +21 -0
  12. data/lib/kitchen/composite_page_element.rb +19 -2
  13. data/lib/kitchen/config.rb +7 -0
  14. data/lib/kitchen/directions/bake_appendix.rb +3 -1
  15. data/lib/kitchen/directions/bake_chapter_introductions.rb +22 -15
  16. data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
  17. data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +1 -1
  18. data/lib/kitchen/directions/bake_chapter_references/main.rb +15 -0
  19. data/lib/kitchen/directions/bake_chapter_references/v1.rb +49 -0
  20. data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
  21. data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
  22. data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
  23. data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
  24. data/lib/kitchen/directions/bake_chapter_summary.rb +13 -6
  25. data/lib/kitchen/directions/bake_composite_chapters.rb +1 -1
  26. data/lib/kitchen/directions/bake_composite_pages.rb +1 -1
  27. data/lib/kitchen/directions/bake_equations.rb +1 -1
  28. data/lib/kitchen/directions/bake_example.rb +4 -1
  29. data/lib/kitchen/directions/bake_figure.rb +13 -0
  30. data/lib/kitchen/directions/bake_first_elements.rb +7 -1
  31. data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
  32. data/lib/kitchen/directions/bake_footnotes/v1.rb +11 -8
  33. data/lib/kitchen/directions/bake_further_research.rb +2 -0
  34. data/lib/kitchen/directions/bake_index/v1.rb +3 -14
  35. data/lib/kitchen/directions/bake_inline_lists.rb +22 -0
  36. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
  37. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
  38. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
  39. data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
  40. data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
  41. data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +10 -1
  42. data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
  43. data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
  44. data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -24
  45. data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
  46. data/lib/kitchen/directions/bake_preface/main.rb +2 -2
  47. data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
  48. data/lib/kitchen/directions/bake_references/main.rb +7 -0
  49. data/lib/kitchen/directions/bake_references/v2.rb +35 -0
  50. data/lib/kitchen/directions/bake_toc.rb +3 -1
  51. data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
  52. data/lib/kitchen/directions/book_answer_key_container/main.rb +2 -2
  53. data/lib/kitchen/directions/book_answer_key_container/v1.rb +4 -3
  54. data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +3 -3
  55. data/lib/kitchen/directions/chapter_review_container/main.rb +2 -2
  56. data/lib/kitchen/directions/chapter_review_container/v1.rb +4 -2
  57. data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +13 -0
  58. data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +10 -0
  59. data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
  60. data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +6 -2
  61. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
  62. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
  63. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +2 -2
  64. data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +11 -7
  65. data/lib/kitchen/document.rb +19 -52
  66. data/lib/kitchen/element_base.rb +48 -12
  67. data/lib/kitchen/element_enumerator_base.rb +24 -1
  68. data/lib/kitchen/element_enumerator_factory.rb +19 -7
  69. data/lib/kitchen/exercise_element.rb +2 -2
  70. data/lib/kitchen/id_tracker.rb +68 -0
  71. data/lib/kitchen/oven.rb +5 -1
  72. data/lib/kitchen/page_element.rb +7 -5
  73. data/lib/kitchen/patches/i18n.rb +34 -0
  74. data/lib/kitchen/patches/integer.rb +24 -0
  75. data/lib/kitchen/patches/nokogiri.rb +62 -0
  76. data/lib/kitchen/patches/nokogiri_profiling.rb +60 -0
  77. data/lib/kitchen/search_query.rb +6 -0
  78. data/lib/kitchen/selector.rb +3 -2
  79. data/lib/kitchen/version.rb +1 -1
  80. data/lib/locales/en.yml +2 -1
  81. data/lib/locales/es.yml +33 -0
  82. data/lib/locales/pl.yml +4 -2
  83. data/lib/openstax_kitchen.rb +1 -5
  84. data/openstax_kitchen.gemspec +1 -0
  85. metadata +42 -7
  86. data/.github/config.yml +0 -14
  87. data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -51
  88. data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +0 -9
  89. data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +0 -19
  90. data/lib/kitchen/transliterations.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6855dd0e84e96799a57645b9023db15a07400c5b6971a0ebb29edf5c87074f0
4
- data.tar.gz: e7106c5faa811f73e25a829258a4aadfccad20c32dc2a0623ec8a2526e44d274
3
+ metadata.gz: 68b22024e79d8b530195dafc0dba4b939f7c5503023ae1fbc1ee876a038595d9
4
+ data.tar.gz: 4a35e7fdbae28ecadd234c1aff6596ef61ec4aaffd4adf2a29bc401ed54b7576
5
5
  SHA512:
6
- metadata.gz: 792c85c2b914719e38cca37b798160353425a6f80074926ead34c03e5fd97e47167dbc7d3efcef30d43a459a3ad917fd2e2e354fe490053e4345775cb7eac4df
7
- data.tar.gz: 95d4ec07de107850a81cec9a714e5dbe83835dd1536005587109292f503d8afa9a1bdc896dc43f3198d59f18769ef7ab4c9ae2ee312d047ab8bee9997cc4c0a6
6
+ metadata.gz: 34d9856998c75fee77bc41b734399ffc3045a93082cba273b636b10411b852ee71f4e9bda86a38108e9293f53136194d3c85cb12ea5c92159d571c64d2b85044
7
+ data.tar.gz: d29fd215321a1ab877c16083b73bb0b872ee67c68a636425e6ef5ded5d8fd9ff7ae77599ec1d9a500e69ad627f175ac7c5fb1194310b8e0979d0cc7160403b55
@@ -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,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [6.1.0] - 2021-06-21
10
+
11
+ * Create a `BakeReferences` V2 for unnumbered section references (minor)
12
+ * Don't check for CHANGELOG when merge a PR to main (patch)
13
+ * Added `BakeInlineLists` (minor)
14
+
15
+ ## [6.0.0] - 2021-06-15
16
+
17
+ * Allow `BakeChapterSummary` to skip pages where there is no summary (minor)
18
+ * Change `PageElement#summary` to return nil instead of raise an error if no matches (major?)
19
+ * Fix bug in `BakeNumberedNotes:::V3` when there are multiple os-numbers (minor)
20
+ * Add Rubocop and a working CHANGELOG check to GitHub actions (patch)
21
+ * Allow `BakeFootnotes` to number footnotes with Roman numerals (minor)
22
+ * Create V2 for `BakeNumberedTables` (minor)
23
+ * Remove extraneous title in `BakeChapterSectionExercises` (minor)
24
+ * Create V2 for `BookAnswerKeyContainer` and `MoveSolutionsToEOC` with singular option for wrapper class (minor)
25
+ * Delete `abstract` and `description` elements from preface in `BakePreface` (minor)
26
+ * Stop deleting the first `<strong>` tag in `BakeNumberedNotes` (major)
27
+ * Allow `BakeFigure` to bake unnumbered splash figures (minor)
28
+ * Extend `ChapterReviewContainer` to accept other classes (major?)
29
+ * Add a `Strategy` for Precalculus (minor)
30
+ * Create a `BakeNumberedNotes` V2 (minor)
31
+ * Added a version of `BakeChapterIntroductions` without a chapter outline (minor)
32
+ * Add `BakeChapterSolutions` which bakes the free response solutions at the eoc (minor)
33
+ * Changed locale `eoc_answer_key_title` to `answer_key_title` as it was only used in eob (major)
34
+ * Added spec for translations (minor)
35
+ * Remove summary attribute from numbered tables, add option to pass title element to `BakePreface` (minor)
36
+ * Renamed `American Government` strategy to `Default` inside `move_solutions_to_answer_key` for other books to use it with a sent in classname (major)
37
+ * Adds `#previous` method to note_elements to find the immediately previous element (minor)
38
+ * Adds `BakeNumberedNotes` V3 (minor)
39
+ * Added line that puts the classname `has-footnote` in the footnote ref's parent element (major)
40
+ * Added a condition into `BakeChapterSummary` so it doesn't bake the title if it already includes the respective number in it
41
+ * Create v3 of MoveExercisesToEOC which differs from v1 by the presence of a section title
42
+ and from v2 the lack of additional "os-section-area" and os-#{@klass} wrapper (minor)
43
+ * Add a condition in BakeNumberedExercise to make it possible to suppress even solutions in the Answer Key (minor)
44
+ * Fix BakeFurtherResearch baking with main bake script error by breaking the loop if further research sections are not present (minor)
45
+ * Rework v1 of `BakeChapterReferences` to bake references also from introduction pages (major)
46
+ * 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)
47
+
48
+ ## [5.0.0] - 2021-06-02
49
+
50
+ * 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)
51
+ * Moved selectors from recipe to kitchen on `BakeFirstElements` Direction (minor)
52
+ * Auto-detect language based on document; force output encoding to UTF-8 (major)
53
+ * Switched to using a library to sort strings in a language-specific way (patch)
54
+ * Remove summary attribute from `BakeNumberedTable` (major)
55
+
56
+ ## [4.1.1] - 2021-05-24
57
+
58
+ * Adds low level Nokogiri caching, disabled by default (patch)
59
+ * Cache Selector objects since they don't change (patch)
60
+ * Use more specific selectors when to reduce bake time (patch)
61
+
62
+ ## [4.1.0] - 2021-05-18
63
+
64
+ * Fixed performance problem with element class detection (patch)
65
+ * Added `BakeChapterReferences` Directions (minor)
66
+
9
67
  ## [4.0.0] - 2021-05-18
10
68
 
11
69
  * Changes `default_css_or_xpath` to optionally be a proc to be evaluated w.r.t. a document's config (minor)
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (4.0.0)
4
+ openstax_kitchen (6.1.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/
@@ -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/README.md CHANGED
@@ -641,6 +641,22 @@ expect(book_1).to match_normalized_html("some string of HTML here")
641
641
  expect(book_1).to match_html_nodes("some string of HTML here")
642
642
  ```
643
643
 
644
+ ### Profiling
645
+
646
+ If you set the `PROFILE` environment variable to something before you run specs or a recipe, search query profile data will be collected and printed, e.g.
647
+
648
+ ```bash
649
+ %> PROFILE=1 rspec
650
+ ```
651
+
652
+ ### Caching
653
+
654
+ There's a low-level CSS query caching tool that saves repeated queries. In some tests, it saves 15% of query time. It is disabled by default (because we aren't super sure that it is completely safe) but can be turned on with
655
+
656
+ ```ruby
657
+ doc.config.enable_search_cache = true
658
+ ```
659
+
644
660
  ### VSCode
645
661
 
646
662
  1. Visit `vscode:extension/ms-vscode-remote.remote-containers` in a browser
data/codecov.yaml CHANGED
@@ -25,3 +25,4 @@ ignore:
25
25
  - "bin"
26
26
  - "docker"
27
27
  - "books"
28
+ - "lib/kitchen/patches/nokogiri_profiling"
data/docker/rubocop ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # set -x
4
+
5
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6
+
7
+ from="${1:-main}"
8
+ to="${2:-HEAD}"
9
+
10
+ echo "Checking from $from to $to"
11
+
12
+ # https://dev.to/scienta/get-changed-files-in-github-actions-1p36
13
+ changed_ruby_files=$(git diff --name-only --diff-filter=ACMRT $from $to | grep -E "(lib\/|spec\/)*.rb$" | xargs)
14
+
15
+ if [[ -z "${changed_ruby_files// }" ]]; then
16
+ echo "No files to lint with Rubocop"
17
+ else
18
+ docker run -v $DIR/..:/code \
19
+ -w /code \
20
+ openstax/kitchen.ci:latest \
21
+ /bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rubocop $changed_ruby_files --disable-pending-cops"
22
+ fi
@@ -29,7 +29,7 @@ module Kitchen
29
29
  # @return [BookElement]
30
30
  #
31
31
  def book
32
- BookElement.new(node: nokogiri_document.search('html').first, document: self)
32
+ BookElement.new(node: nokogiri_document.root, document: self)
33
33
  end
34
34
 
35
35
  end
@@ -41,7 +41,7 @@ module Kitchen
41
41
  # @return [Element, nil]
42
42
  #
43
43
  def introduction_page
44
- pages('.introduction').first
44
+ pages('$.introduction').first
45
45
  end
46
46
 
47
47
  # Returns an enumerator for the glossaries
@@ -65,7 +65,7 @@ module Kitchen
65
65
  # @return [ElementEnumerator]
66
66
  #
67
67
  def abstracts
68
- search('[data-type="abstract"]')
68
+ search('div[data-type="abstract"]')
69
69
  end
70
70
 
71
71
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ # An enumerator for composite page elements
5
+ #
6
+ class CompositeChapterElementEnumerator < ElementEnumeratorBase
7
+
8
+ # Returns a factory for this enumerator
9
+ #
10
+ # @return [ElementEnumeratorFactory]
11
+ #
12
+ def self.factory
13
+ ElementEnumeratorFactory.new(
14
+ default_css_or_xpath: Selector.named(:composite_chapter),
15
+ sub_element_class: CompositeChapterElement,
16
+ enumerator_class: self
17
+ )
18
+ end
19
+
20
+ end
21
+ end
@@ -43,13 +43,30 @@ 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
47
56
  #
48
57
  # @return [Boolean]
49
58
  #
50
- def is_reference?
59
+ def is_citation_reference?
51
60
  has_class?('os-reference-container')
52
61
  end
53
62
 
63
+ # Returns true if this page is a book section reference
64
+ #
65
+ # @return [Boolean]
66
+ #
67
+ def is_section_reference?
68
+ has_class?('os-references-container')
69
+ end
70
+
54
71
  end
55
72
  end
@@ -17,6 +17,12 @@ module Kitchen
17
17
  #
18
18
  attr_accessor :enable_all_namespaces
19
19
 
20
+ # @!attribute [rw] enable_search_cache
21
+ #
22
+ # @return [Boolean]
23
+ #
24
+ attr_accessor :enable_search_cache
25
+
20
26
  # Creates a new config from a file (not implemented)
21
27
  #
22
28
  def self.new_from_file(_file)
@@ -28,6 +34,7 @@ module Kitchen
28
34
  def initialize(hash: {}, selectors: nil)
29
35
  @selectors = selectors || Kitchen::Selectors::Standard1.new
30
36
  @enable_all_namespaces = hash[:enable_all_namespaces] || true
37
+ @enable_search_cache = hash[:enable_search_cache] || false
31
38
  @hash = hash
32
39
  end
33
40
  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
@@ -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}
@@ -19,7 +19,7 @@ module Kitchen::Directions::BakeChapterKeyConcepts
19
19
  key_concepts.each do |key_concept|
20
20
  key_concept.prepend(child: title)
21
21
  key_concept.wrap("<div class='os-section-area'>")
22
- page.search('.os-section-area').first.cut(to: key_concepts_clipboard)
22
+ page.search('div.os-section-area').first.cut(to: key_concepts_clipboard)
23
23
  end
24
24
  end
25
25
 
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kitchen
4
+ module Directions
5
+ module BakeChapterReferences
6
+ def self.v1(chapter:, metadata_source:, uuid_prefix: '.', klass: 'references')
7
+ V1.new.bake(
8
+ chapter: chapter,
9
+ metadata_source: metadata_source,
10
+ uuid_prefix: uuid_prefix,
11
+ klass: klass)
12
+ end
13
+ end
14
+ end
15
+ end