openstax_kitchen 4.1.1 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/changelog.yml +24 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/CHANGELOG.md +62 -0
- data/Gemfile.lock +16 -7
- data/docker/rubocop +24 -0
- data/lib/kitchen/composite_page_element.rb +20 -3
- data/lib/kitchen/directions/bake_appendix.rb +3 -1
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +23 -5
- data/lib/kitchen/directions/bake_chapter_introductions.rb +22 -15
- data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
- data/lib/kitchen/directions/bake_chapter_references/main.rb +1 -2
- data/lib/kitchen/directions/bake_chapter_references/v1.rb +26 -12
- data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
- data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
- data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
- data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
- data/lib/kitchen/directions/bake_chapter_summary.rb +13 -6
- data/lib/kitchen/directions/bake_example.rb +11 -2
- data/lib/kitchen/directions/bake_figure.rb +13 -0
- data/lib/kitchen/directions/bake_first_elements.rb +7 -1
- data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
- data/lib/kitchen/directions/bake_footnotes/v1.rb +11 -8
- data/lib/kitchen/directions/bake_further_research.rb +2 -0
- data/lib/kitchen/directions/bake_index/v1.rb +3 -14
- data/lib/kitchen/directions/bake_inline_lists.rb +22 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +10 -1
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
- data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -24
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
- data/lib/kitchen/directions/bake_preface/main.rb +2 -2
- data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
- data/lib/kitchen/directions/bake_references/main.rb +7 -0
- data/lib/kitchen/directions/bake_references/v2.rb +35 -0
- data/lib/kitchen/directions/bake_toc.rb +3 -1
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
- data/lib/kitchen/directions/book_answer_key_container/main.rb +2 -2
- data/lib/kitchen/directions/book_answer_key_container/v1.rb +4 -3
- data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +3 -3
- data/lib/kitchen/directions/chapter_review_container/main.rb +2 -2
- data/lib/kitchen/directions/chapter_review_container/v1.rb +4 -2
- data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +13 -0
- data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +10 -0
- data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +6 -2
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +11 -7
- data/lib/kitchen/document.rb +17 -42
- data/lib/kitchen/element_base.rb +31 -7
- data/lib/kitchen/i18n_string.rb +16 -0
- data/lib/kitchen/id_tracker.rb +68 -0
- data/lib/kitchen/oven.rb +3 -1
- data/lib/kitchen/page_element.rb +2 -3
- data/lib/kitchen/patches/array.rb +15 -0
- data/lib/kitchen/patches/i18n.rb +34 -0
- data/lib/kitchen/patches/integer.rb +24 -0
- data/lib/kitchen/patches/nokogiri.rb +7 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +2 -1
- data/lib/locales/es.yml +33 -0
- data/lib/locales/pl.yml +3 -1
- data/lib/openstax_kitchen.rb +2 -5
- data/openstax_kitchen.gemspec +1 -0
- metadata +40 -7
- data/.github/config.yml +0 -14
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -51
- data/lib/kitchen/directions/book_answer_key_container/eob_solutions_container.xhtml.erb +0 -9
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/american_government.rb +0 -19
- data/lib/kitchen/transliterations.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46fe1771e5853e9149dc1df841fafeaba3d3b157ab850d66f94745406867d901
|
4
|
+
data.tar.gz: 1f97e7a288fb5a9c7c96c3f9352238736ac9854a8b0a06379328253f89e9552f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
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.
|
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
|
-
|
22
|
-
|
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.
|
27
|
+
concurrent-ruby (1.1.9)
|
25
28
|
diff-lcs (1.3)
|
26
|
-
docile (1.
|
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.
|
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
|
-
#
|
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
|
51
|
-
has_class?('os-
|
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
|
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
|
-
|
14
|
-
|
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 =
|
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
|
-
|
9
|
-
next if page.is_introduction?
|
8
|
+
chapter_outline_html = ''
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<
|
17
|
-
|
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
|
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
|
-
|
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}
|
File without changes
|
@@ -12,24 +12,38 @@ module Kitchen::Directions::BakeChapterReferences
|
|
12
12
|
|
13
13
|
chapter.references.search('h3').trash
|
14
14
|
|
15
|
-
chapter.
|
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
|
-
|
23
|
-
|
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
|