openstax_kitchen 9.0.0 → 11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -1
- data/Gemfile.lock +2 -2
- data/lib/kitchen/chapter_element.rb +8 -0
- data/lib/kitchen/composite_page_element.rb +2 -4
- data/lib/kitchen/directions/bake_annotation_classes/main.rb +12 -0
- data/lib/kitchen/directions/bake_annotation_classes/v1.rb +32 -0
- data/lib/kitchen/directions/bake_chapter_glossary/main.rb +3 -2
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +10 -1
- data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +11 -21
- data/lib/kitchen/directions/bake_chapter_references/v1.rb +1 -3
- data/lib/kitchen/directions/bake_chapter_solutions/main.rb +7 -2
- data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +11 -9
- data/lib/kitchen/directions/bake_chapter_summary.rb +1 -2
- data/lib/kitchen/directions/bake_eoc_section_content/change_subsection_title_tag.rb +13 -0
- data/lib/kitchen/directions/bake_example.rb +6 -8
- data/lib/kitchen/directions/bake_first_elements.rb +15 -2
- data/lib/kitchen/directions/bake_folio.rb +12 -0
- data/lib/kitchen/directions/bake_free_response/v1.rb +1 -1
- data/lib/kitchen/directions/bake_further_research.rb +1 -3
- data/lib/kitchen/directions/bake_handbook/main.rb +11 -0
- data/lib/kitchen/directions/bake_handbook/v1.rb +74 -0
- data/lib/kitchen/directions/bake_inline_lists.rb +1 -1
- data/lib/kitchen/directions/bake_lists_with_para.rb +17 -0
- data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +1 -0
- data/lib/kitchen/directions/bake_notes/bake_note_iframes.rb +27 -0
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +19 -0
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +57 -16
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +2 -2
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +2 -2
- data/lib/kitchen/directions/bake_toc.rb +9 -0
- data/lib/kitchen/directions/bake_unit_page_title/main.rb +11 -0
- data/lib/kitchen/directions/bake_unit_page_title/v1.rb +23 -0
- data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +32 -21
- data/lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb +4 -3
- data/lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb +19 -3
- data/lib/kitchen/directions/move_exercises_to_eoc/v1.rb +1 -2
- data/lib/kitchen/directions/move_exercises_to_eoc/v2.rb +11 -30
- data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +1 -2
- data/lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_exercise_section.rb +40 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb +33 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/solution_area_snippet.rb +12 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb +23 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +19 -40
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +6 -48
- data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +10 -3
- data/lib/kitchen/element_base.rb +0 -4
- data/lib/kitchen/example_element.rb +9 -3
- data/lib/kitchen/exercise_element.rb +8 -0
- data/lib/kitchen/figure_element.rb +11 -0
- data/lib/kitchen/metadata_element.rb +2 -2
- data/lib/kitchen/note_element.rb +8 -1
- data/lib/kitchen/page_element.rb +19 -8
- data/lib/kitchen/table_element.rb +25 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +6 -0
- data/lib/locales/es.yml +3 -0
- metadata +16 -4
- data/lib/kitchen/directions/bake_theorem/main.rb +0 -11
- data/lib/kitchen/directions/bake_theorem/v1.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6964a7fe85234e82e7f54f3b6d4980633f4f4c29c49d3123743c214d9f46653
|
|
4
|
+
data.tar.gz: 2426f1990ae74d35d2ac098bcf7d5c09aa5094eeef598dd9658d8fedf97916c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: faba0041d8c958c3ffa369dbe2d0c5453f8a236bedd0654e362afa65c84093ec22771dadaa9a313e688f6644681267b63f263ba60af9d1b81a211bc3c98a5df1
|
|
7
|
+
data.tar.gz: a1e8ff40b3377508904ab62980302f129527755512f58506c805d7ae1507977ce65f1c993786cdeffc5f3871e4448e5d4df264979539d60f995d7f9c7b3ece48
|
data/CHANGELOG.md
CHANGED
|
@@ -6,9 +6,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [11.0.0] - 2021-08-6
|
|
10
|
+
|
|
11
|
+
* Add `ChangeSubsectionTitleTag` direction for modifying eoc sections (minor)
|
|
12
|
+
* Add `MoveSolutionsFromNumberedNote`, `MoveSolutionsFromExerciseSection`, and `SolutionAreaSnippet` for answer key baking (minor)
|
|
13
|
+
* Refactor the following `Strategies`: contemporary math, precalculus, uphysics (minor)
|
|
14
|
+
* Fix `BakeUnitPageTite` to utilize only pages which are direct children of the unit (patch)
|
|
15
|
+
* Patch `BakeFirstElements` to include first figure elements (patch)
|
|
16
|
+
* Refactor `MoveCustomSectionToEocContainer` to remove `include_intro_page` (major)
|
|
17
|
+
* Update `BakeFirstElement` to optionally add the `has-first-inline-element` class (patch)
|
|
18
|
+
* Patch `BakeExample` crashing if an example has commentary but no title (patch)
|
|
19
|
+
* Refactor `EocSectionTitleLinkSnippet` to only have v1 with optional params (major)
|
|
20
|
+
* Adds `PageElement#count_in_chapter_without_intro_page` (minor)
|
|
21
|
+
* Adds `ChapterElement#has_introduction?` (minor)
|
|
22
|
+
* Adds `BakeFolio` to set spanish translation variables in the html tag for folio-pdf purposes (minor)
|
|
23
|
+
* Create `BakeAnnotationClasses` v1 for English Composition (minor)
|
|
24
|
+
|
|
25
|
+
## [10.0.0] - 2021-07-30
|
|
26
|
+
|
|
27
|
+
* Add support for baking multipart questions to `BakeNumberedExercise` (minor)
|
|
28
|
+
* Add `has_para` option to `BakeChapterGlossary` for books from Adaptarr (minor)
|
|
29
|
+
* Create `BakeListsWithPara` to remove paragraphs from lists in books created by Adaptarr (minor)
|
|
30
|
+
* Create `Strategy::ContemporaryMath` (minor)
|
|
31
|
+
* Stop `BakeTableBody` from blowing up when table doesn't have an ID (patch)
|
|
32
|
+
* Refactor `MoveExercisesToEOC::V2` & `BakeChapterKeyConcepts` to use `MoveCustomSectionToEocContainer` (minor)
|
|
33
|
+
* Add wrapper support for `MoveCustomSectionToEocContainer` (minor)
|
|
34
|
+
* Create `BakeHandbook` direction (minor)
|
|
35
|
+
* Add `ExampleElement#titles_to_rename` & refactor `BakeExample` (patch)
|
|
36
|
+
* Create `BakeUnitPageTitle` (minor)
|
|
37
|
+
* Fix `BakeExample` to skip baked exercises (patch)
|
|
38
|
+
* Add `FigureElement#figure_to_bake?` (minor)
|
|
39
|
+
* Remove `itemprop` attribute from `BakeChapterSummary` and `BakeFurtherResearch` (major)
|
|
40
|
+
* Fix `NoteElement#title` to exclude nested element titles (patch)
|
|
41
|
+
* Remove `BakeTheorem` (minor)
|
|
42
|
+
* Allow `BakeChapterSolutions` to bake solutions from multiple sections (minor)
|
|
43
|
+
* Add `.os-problem-container` to `BakeFirstElement` selectors (minor)
|
|
44
|
+
* Tweak `BakeExample` to not touch unbaked titles in captions (minor/patch)
|
|
45
|
+
* Tweak `BakeNumberedTables.v1` to cut extra white space (minor)
|
|
46
|
+
|
|
47
|
+
## [9.2.0] - 2021-07-19
|
|
48
|
+
|
|
49
|
+
* Update `BakeFirstElements` to also add the `.has-first-inline-list` class (minor)
|
|
50
|
+
|
|
51
|
+
## [9.1.0] - 2021-07-16
|
|
52
|
+
|
|
53
|
+
* Add `BakeNoteIFrames` direction (minor)
|
|
54
|
+
* Selector optimization in precalculus `Strategy` & elsewhere (patch)
|
|
55
|
+
* Tweaks inline list seperators to only target labeled items (major?)
|
|
56
|
+
* Add definition of handbook page selector needed for BakeToc, create a link class for this page (minor)
|
|
57
|
+
|
|
9
58
|
## [9.0.0] - 2021-07-12
|
|
10
59
|
|
|
11
|
-
* Refactor `BakeChapterKeyConcepts`, `BakeChapterReferences`, `BakeChapterSolutions`, and `MoveExercisesToEoc` versions 1-3 to use new general eoc directions (major
|
|
60
|
+
* Refactor `BakeChapterKeyConcepts`, `BakeChapterReferences`, `BakeChapterSolutions`, and `MoveExercisesToEoc` versions 1-3 to use new general eoc directions (major)
|
|
12
61
|
* Fixed `BakeExample.v1` to also search inside `.body` for titles (minor)
|
|
13
62
|
* Add documentation to `MoveCustomSectionToEocContainer` & `EocCompositePageContainer` (minor)
|
|
14
63
|
* Add a `MoveCustomSectionToEocContainer` to allow for custom sections (minor)
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
openstax_kitchen (
|
|
4
|
+
openstax_kitchen (11.0.0)
|
|
5
5
|
activesupport
|
|
6
6
|
i18n
|
|
7
7
|
nokogiri
|
|
@@ -99,7 +99,7 @@ GEM
|
|
|
99
99
|
tins (~> 1.0)
|
|
100
100
|
tins (1.26.0)
|
|
101
101
|
sync
|
|
102
|
-
twitter_cldr (6.
|
|
102
|
+
twitter_cldr (6.7.0)
|
|
103
103
|
camertron-eprun
|
|
104
104
|
cldr-plurals-runtime-rb (~> 1.1)
|
|
105
105
|
tzinfo
|
|
@@ -44,6 +44,14 @@ module Kitchen
|
|
|
44
44
|
pages('$.introduction').first
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# Returns true if the chapter has an introduction
|
|
48
|
+
#
|
|
49
|
+
# @return [Boolean]
|
|
50
|
+
#
|
|
51
|
+
def has_introduction?
|
|
52
|
+
@has_introduction ||= introduction_page.present?
|
|
53
|
+
end
|
|
54
|
+
|
|
47
55
|
# Returns an enumerator for the glossaries
|
|
48
56
|
#
|
|
49
57
|
# @return [ElementEnumerator]
|
|
@@ -29,10 +29,8 @@ module Kitchen
|
|
|
29
29
|
# @return [Element]
|
|
30
30
|
#
|
|
31
31
|
def title
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# but xpath is shorter
|
|
35
|
-
first!("./*[@data-type = 'document-title' or @data-type = 'title']")
|
|
32
|
+
first!('h3[data-type="title"], h2[data-type="document-title"],' \
|
|
33
|
+
'h1[data-type="document-title"]')
|
|
36
34
|
end
|
|
37
35
|
|
|
38
36
|
# Returns true if this page is a book index
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kitchen::Directions::BakeAnnotationClasses
|
|
4
|
+
class V1
|
|
5
|
+
def bake(chapter:)
|
|
6
|
+
chapter.search('p.annotation').each do |annotation|
|
|
7
|
+
annotation.wrap_children('span', class: 'os-text')
|
|
8
|
+
annotation.prepend(child:
|
|
9
|
+
<<~HTML
|
|
10
|
+
<div class="os-icons"></div>
|
|
11
|
+
HTML
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
annotation_icon_classes = %w[linguistic-icon
|
|
15
|
+
culture-icon
|
|
16
|
+
dreaming-icon
|
|
17
|
+
visual-icon
|
|
18
|
+
speech-icon
|
|
19
|
+
auditory-icon
|
|
20
|
+
kinesthetic-icon]
|
|
21
|
+
annotation_icon_classes.each do |annotation_icon_class|
|
|
22
|
+
chapter.search("p.#{annotation_icon_class}").each do |annotation_with_icon_class|
|
|
23
|
+
annotation_with_icon_class.search('div.os-icons').first.append(child:
|
|
24
|
+
<<~HTML
|
|
25
|
+
<span class = "#{annotation_icon_class}"></span>
|
|
26
|
+
HTML
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -5,12 +5,13 @@ module Kitchen
|
|
|
5
5
|
# Bake directons for eoc glossary
|
|
6
6
|
#
|
|
7
7
|
module BakeChapterGlossary
|
|
8
|
-
def self.v1(chapter:, metadata_source:, append_to: nil, uuid_prefix: nil)
|
|
8
|
+
def self.v1(chapter:, metadata_source:, append_to: nil, uuid_prefix: nil, has_para: false)
|
|
9
9
|
V1.new.bake(
|
|
10
10
|
chapter: chapter,
|
|
11
11
|
metadata_source: metadata_source,
|
|
12
12
|
append_to: append_to,
|
|
13
|
-
uuid_prefix: uuid_prefix
|
|
13
|
+
uuid_prefix: uuid_prefix,
|
|
14
|
+
has_para: has_para
|
|
14
15
|
)
|
|
15
16
|
end
|
|
16
17
|
end
|
|
@@ -21,9 +21,18 @@ module Kitchen::Directions::BakeChapterGlossary
|
|
|
21
21
|
attr_reader :sortable
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def bake(chapter:, metadata_source:, append_to: nil, uuid_prefix: '')
|
|
24
|
+
def bake(chapter:, metadata_source:, append_to: nil, uuid_prefix: '', has_para: false)
|
|
25
25
|
@glossary = []
|
|
26
26
|
|
|
27
|
+
# Use for books created by Adaptarr, where dd contains paragraphs
|
|
28
|
+
# More info: https://github.com/openstax/kitchen/issues/284
|
|
29
|
+
if has_para
|
|
30
|
+
chapter.glossaries.search('dd').each do |description|
|
|
31
|
+
description_content = description.first('p').text
|
|
32
|
+
description.replace_children with: description_content
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
27
36
|
chapter.glossaries.search('dl').each do |definition_element|
|
|
28
37
|
@glossary.push(Definition.new(definition_element.cut))
|
|
29
38
|
end
|
|
@@ -3,29 +3,19 @@
|
|
|
3
3
|
module Kitchen::Directions::BakeChapterKeyConcepts
|
|
4
4
|
class V1
|
|
5
5
|
def bake(chapter:, metadata_source:, append_to:, uuid_prefix:)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
next if key_concepts.none?
|
|
10
|
-
|
|
11
|
-
title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: page)
|
|
12
|
-
key_concepts.each do |key_concept|
|
|
13
|
-
Kitchen::Directions::RemoveSectionTitle.v1(section: key_concept)
|
|
14
|
-
key_concept.prepend(child: title)
|
|
15
|
-
key_concept.wrap("<div class='os-section-area'>")
|
|
16
|
-
page.search('div.os-section-area').first.cut(to: key_concepts_clipboard)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
content = "<div class=\"os-key-concepts\"> #{key_concepts_clipboard.paste} </div>"
|
|
21
|
-
|
|
22
|
-
Kitchen::Directions::EocCompositePageContainer.v1(
|
|
6
|
+
Kitchen::Directions::MoveCustomSectionToEocContainer.v1(
|
|
7
|
+
chapter: chapter,
|
|
8
|
+
metadata_source: metadata_source,
|
|
23
9
|
container_key: 'key-concepts',
|
|
24
10
|
uuid_key: "#{uuid_prefix}key-concepts",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
11
|
+
section_selector: 'section.key-concepts',
|
|
12
|
+
append_to: append_to || chapter,
|
|
13
|
+
wrap_section: true, wrap_content: true
|
|
14
|
+
) do |section|
|
|
15
|
+
Kitchen::Directions::RemoveSectionTitle.v1(section: section)
|
|
16
|
+
title = Kitchen::Directions::EocSectionTitleLinkSnippet.v1(page: section.ancestor(:page))
|
|
17
|
+
section.prepend(child: title)
|
|
18
|
+
end
|
|
29
19
|
end
|
|
30
20
|
end
|
|
31
21
|
end
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
module Kitchen::Directions::BakeChapterReferences
|
|
4
4
|
class V1
|
|
5
5
|
def bake(chapter:, metadata_source:, uuid_prefix: '.', klass: 'references')
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
chapter.non_introduction_pages.each do |page|
|
|
6
|
+
chapter.pages.each do |page|
|
|
9
7
|
bake_page_references(page: page)
|
|
10
8
|
end
|
|
11
9
|
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
module Kitchen
|
|
4
4
|
module Directions
|
|
5
5
|
module BakeChapterSolutions
|
|
6
|
-
def self.v1(chapter:, metadata_source:, uuid_prefix: '')
|
|
7
|
-
V1.new.bake(
|
|
6
|
+
def self.v1(chapter:, metadata_source:, uuid_prefix: '', classes: %w[free-response])
|
|
7
|
+
V1.new.bake(
|
|
8
|
+
chapter: chapter,
|
|
9
|
+
metadata_source: metadata_source,
|
|
10
|
+
uuid_prefix: uuid_prefix,
|
|
11
|
+
classes: classes
|
|
12
|
+
)
|
|
8
13
|
end
|
|
9
14
|
end
|
|
10
15
|
end
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module Kitchen::Directions::BakeChapterSolutions
|
|
4
4
|
class V1
|
|
5
|
-
def bake(chapter:, metadata_source:, uuid_prefix: '')
|
|
5
|
+
def bake(chapter:, metadata_source:, uuid_prefix: '', classes: %w[free-response])
|
|
6
6
|
solutions_clipboard = Kitchen::Clipboard.new
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
classes.each do |klass|
|
|
9
|
+
chapter.search("section.#{klass}").each do |question|
|
|
10
|
+
exercises = question.exercises
|
|
11
|
+
# must run AFTER the other sections are baked
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
next if exercises.none?
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
exercises.each do |exercise|
|
|
16
|
+
solution = exercise.solution
|
|
17
|
+
next unless solution.present?
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
solution.cut(to: solutions_clipboard)
|
|
20
|
+
end
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
|
|
@@ -18,7 +18,7 @@ module Kitchen
|
|
|
18
18
|
def bake(chapter:, metadata_source:, uuid_prefix: '.', klass: 'summary')
|
|
19
19
|
summaries = Clipboard.new
|
|
20
20
|
|
|
21
|
-
chapter.
|
|
21
|
+
chapter.pages.each do |page|
|
|
22
22
|
summary = page.summary
|
|
23
23
|
|
|
24
24
|
next if summary.nil?
|
|
@@ -26,7 +26,6 @@ module Kitchen
|
|
|
26
26
|
summary.first("[data-type='title']")&.trash # get rid of old title if exists
|
|
27
27
|
title = EocSectionTitleLinkSnippet.v1(page: page)
|
|
28
28
|
summary.prepend(child: title)
|
|
29
|
-
summary.first('h3')[:itemprop] = 'name'
|
|
30
29
|
summary.cut(to: summaries)
|
|
31
30
|
end
|
|
32
31
|
|
|
@@ -20,18 +20,14 @@ module Kitchen
|
|
|
20
20
|
.pantry(name: :link_text)
|
|
21
21
|
.store("#{I18n.t(:example_label)} #{number}", label: example.id)
|
|
22
22
|
|
|
23
|
-
example.
|
|
24
|
-
if title.parent.has_class?('os-caption-container') || \
|
|
25
|
-
title.parent.has_class?('os-caption')
|
|
26
|
-
next
|
|
27
|
-
end
|
|
28
|
-
|
|
23
|
+
example.titles_to_rename.each do |title|
|
|
29
24
|
title.name = 'h4'
|
|
30
25
|
end
|
|
31
26
|
|
|
32
27
|
example.exercises.each do |exercise|
|
|
28
|
+
next if exercise.baked?
|
|
29
|
+
|
|
33
30
|
if (problem = exercise.problem)
|
|
34
|
-
problem.titles.each { |title| title.name = 'h4' }
|
|
35
31
|
problem.wrap_children(class: 'os-problem-container')
|
|
36
32
|
end
|
|
37
33
|
|
|
@@ -54,10 +50,12 @@ module Kitchen
|
|
|
54
50
|
|
|
55
51
|
exercise.add_class('unnumbered')
|
|
56
52
|
|
|
57
|
-
commentary = exercise.first('[data-type="commentary"]')
|
|
53
|
+
commentary = exercise.first('div[data-type="commentary"]')
|
|
58
54
|
next unless commentary.present?
|
|
59
55
|
|
|
60
56
|
commentary_title = commentary.titles.first
|
|
57
|
+
next unless commentary_title.present?
|
|
58
|
+
|
|
61
59
|
commentary_title.name = 'h4'
|
|
62
60
|
commentary_title['data-type'] = 'commentary-title'
|
|
63
61
|
commentary_title.wrap_children('span', class: 'os-title-label')
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
module Kitchen
|
|
4
4
|
module Directions
|
|
5
5
|
module BakeFirstElements
|
|
6
|
-
def self.v1(within:)
|
|
6
|
+
def self.v1(within:, first_inline_list: false)
|
|
7
|
+
# add has-first-element class
|
|
7
8
|
selectors = [
|
|
8
9
|
'div.os-problem-container > div.os-table',
|
|
9
10
|
'div.os-problem-container > span[data-type="media"]',
|
|
11
|
+
'div.os-problem-container > div.os-figure',
|
|
10
12
|
'div.os-solution-container > div.os-table',
|
|
11
|
-
'div.os-solution-container > span[data-type="media"]'
|
|
13
|
+
'div.os-solution-container > span[data-type="media"]',
|
|
14
|
+
'div.os-solution-container > div.os-figure'
|
|
12
15
|
]
|
|
13
16
|
selectors.each do |selector|
|
|
14
17
|
within.search("#{selector}:first-child").each do |problem|
|
|
@@ -16,6 +19,16 @@ module Kitchen
|
|
|
16
19
|
problem.parent.add_class('has-first-element')
|
|
17
20
|
end
|
|
18
21
|
end
|
|
22
|
+
|
|
23
|
+
return unless first_inline_list
|
|
24
|
+
|
|
25
|
+
# add first-inline-element class
|
|
26
|
+
inline_selector = 'div.os-solution-container > ol[type="1"]:first-child,' \
|
|
27
|
+
'div.os-problem-container > ol[type="1"]:first-child'
|
|
28
|
+
within.search(inline_selector).each do |inline_list|
|
|
29
|
+
inline_list.add_class('first-inline-list-element')
|
|
30
|
+
inline_list.parent.add_class('has-first-inline-list-element')
|
|
31
|
+
end
|
|
19
32
|
end
|
|
20
33
|
end
|
|
21
34
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kitchen
|
|
4
|
+
module Directions
|
|
5
|
+
module BakeFolio
|
|
6
|
+
def self.v1(book:)
|
|
7
|
+
book['data-pdf-folio-preface-message'] = I18n.t(:"folio.preface")
|
|
8
|
+
book['data-pdf-folio-access-message'] = I18n.t(:"folio.access_for_free")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -8,7 +8,7 @@ module Kitchen::Directions::BakeFreeResponse
|
|
|
8
8
|
@metadata_elements = metadata_source.children_to_keep.copy
|
|
9
9
|
|
|
10
10
|
@free_response_clipboard = Kitchen::Clipboard.new
|
|
11
|
-
chapter.
|
|
11
|
+
chapter.pages.each do |page|
|
|
12
12
|
free_response_questions = page.free_response
|
|
13
13
|
next if free_response_questions.none?
|
|
14
14
|
|
|
@@ -20,13 +20,11 @@ module Kitchen
|
|
|
20
20
|
container_key: 'further-research',
|
|
21
21
|
uuid_key: "#{uuid_prefix}further-research",
|
|
22
22
|
section_selector: 'section.further-research',
|
|
23
|
-
append_to: nil
|
|
24
|
-
include_intro_page: false
|
|
23
|
+
append_to: nil
|
|
25
24
|
) do |further_research|
|
|
26
25
|
RemoveSectionTitle.v1(section: further_research)
|
|
27
26
|
title = EocSectionTitleLinkSnippet.v1(page: further_research.ancestor(:page))
|
|
28
27
|
further_research.prepend(child: title)
|
|
29
|
-
further_research.first('h3')[:itemprop] = 'name'
|
|
30
28
|
end
|
|
31
29
|
end
|
|
32
30
|
end
|