openstax_kitchen 9.0.0 → 9.1.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 +8 -1
- data/Gemfile.lock +1 -1
- data/lib/kitchen/composite_page_element.rb +2 -4
- data/lib/kitchen/directions/bake_example.rb +1 -1
- data/lib/kitchen/directions/bake_inline_lists.rb +1 -1
- 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_toc.rb +2 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +4 -4
- data/lib/kitchen/metadata_element.rb +2 -2
- data/lib/kitchen/page_element.rb +8 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df33d6b0ba524fe49e9e5310bcdb730406576a3b88f0462e2eedd932d08fc0cf
|
4
|
+
data.tar.gz: 6a23406fdebb4676c22424d14ab805304789814e84302a685aa245e2bf87f846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af05295d5045ec827b6e817443a4648591d138bc9d3cf697221187e26088badc6c76048f8b3902a167c073c1e9ee94b4c4f48934171428b649c879e23abd95f
|
7
|
+
data.tar.gz: 35ce7b8d16222c5f338d2eb6e9749158980e075b2d09bfa82e034e74bcfad13b748b80bceb1941fc0a8b4d26cf834474a0e7699a7327b55c6e6e42bc1e122024
|
data/CHANGELOG.md
CHANGED
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [9.1.0] - 2021-07-16
|
10
|
+
|
11
|
+
* Add `BakeNoteIFrames` direction (minor)
|
12
|
+
* Selector optimization in precalculus `Strategy` & elsewhere (patch)
|
13
|
+
* Tweaks inline list seperators to only target labeled items (major?)
|
14
|
+
* Add definition of handbook page selector needed for BakeToc, create a link class for this page (minor)
|
15
|
+
|
9
16
|
## [9.0.0] - 2021-07-12
|
10
17
|
|
11
|
-
* Refactor `BakeChapterKeyConcepts`, `BakeChapterReferences`, `BakeChapterSolutions`, and `MoveExercisesToEoc` versions 1-3 to use new general eoc directions (major
|
18
|
+
* Refactor `BakeChapterKeyConcepts`, `BakeChapterReferences`, `BakeChapterSolutions`, and `MoveExercisesToEoc` versions 1-3 to use new general eoc directions (major)
|
12
19
|
* Fixed `BakeExample.v1` to also search inside `.body` for titles (minor)
|
13
20
|
* Add documentation to `MoveCustomSectionToEocContainer` & `EocCompositePageContainer` (minor)
|
14
21
|
* Add a `MoveCustomSectionToEocContainer` to allow for custom sections (minor)
|
data/Gemfile.lock
CHANGED
@@ -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
|
@@ -54,7 +54,7 @@ module Kitchen
|
|
54
54
|
|
55
55
|
exercise.add_class('unnumbered')
|
56
56
|
|
57
|
-
commentary = exercise.first('[data-type="commentary"]')
|
57
|
+
commentary = exercise.first('div[data-type="commentary"]')
|
58
58
|
next unless commentary.present?
|
59
59
|
|
60
60
|
commentary_title = commentary.titles.first
|
@@ -10,7 +10,7 @@ module Kitchen
|
|
10
10
|
SEPARATOR_CLASS = '-os-inline-list-separator'
|
11
11
|
|
12
12
|
def self.v1(book:)
|
13
|
-
inline_lists = book.search('span[data-display="inline"][data-type="
|
13
|
+
inline_lists = book.search('span[data-display="inline"][data-list-type="labeled-item"]')
|
14
14
|
inline_lists.each do |list|
|
15
15
|
list.search('span[data-type="item"]')[0..-2].each do |item|
|
16
16
|
item.append(child: "<span class=\"#{SEPARATOR_CLASS}\">#{LIST_SEPARATOR}</span>")
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
module BakeNoteIFrames
|
6
|
+
def self.v1(note:)
|
7
|
+
iframes = note.search('iframe')
|
8
|
+
return unless iframes.any?
|
9
|
+
|
10
|
+
iframes.each do |iframe|
|
11
|
+
iframe.wrap('<div class="os-has-iframe" data-type="alternatives">')
|
12
|
+
iframe.add_class('os-is-iframe')
|
13
|
+
link_ref = iframe[:src]
|
14
|
+
next unless link_ref
|
15
|
+
|
16
|
+
iframe = iframe.parent
|
17
|
+
iframe.add_class('os-has-link')
|
18
|
+
iframe.prepend(child:
|
19
|
+
<<~HTML
|
20
|
+
<a class="os-is-link" href="#{link_ref}" target="_window">#{I18n.t(:iframe_link_text)}</a>
|
21
|
+
HTML
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -24,8 +24,8 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
24
24
|
|
25
25
|
def bake_section(chapter:, append_to:, klass:, number: nil)
|
26
26
|
section_solutions_set = Kitchen::Clipboard.new
|
27
|
-
chapter.search(".#{klass}").each do |section|
|
28
|
-
section.search('[data-type="solution"]').each do |solution|
|
27
|
+
chapter.search("section.#{klass}").each do |section|
|
28
|
+
section.search('div[data-type="solution"]').each do |solution|
|
29
29
|
solution.cut(to: section_solutions_set)
|
30
30
|
end
|
31
31
|
end
|
@@ -56,7 +56,7 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
56
56
|
page.notes('$.try').each do |note|
|
57
57
|
note.exercises.each do |exercise|
|
58
58
|
solution = exercise.solution
|
59
|
-
solution&.cut(to: solutions)
|
59
|
+
solution&.cut(to: solutions)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
next if solutions.items.empty?
|
@@ -64,7 +64,7 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
|
|
64
64
|
title_snippet = Kitchen::Directions::EocSectionTitleLinkSnippet.v2(page: page)
|
65
65
|
|
66
66
|
append_solution_area(title: title_snippet, solutions: solutions,
|
67
|
-
append_to: append_to.search('.os-try-solution-area').first)
|
67
|
+
append_to: append_to.search('div.os-try-solution-area').first)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -27,8 +27,8 @@ module Kitchen
|
|
27
27
|
# @return [ElementEnumerator]
|
28
28
|
#
|
29
29
|
def children_to_keep
|
30
|
-
search(%w([data-type='revised'] .authors .publishers .print-style .permissions
|
31
|
-
[data-type='subject']))
|
30
|
+
search(%w(span[data-type='revised'] div.authors div.publishers div.print-style div.permissions
|
31
|
+
div[data-type='subject']))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/kitchen/page_element.rb
CHANGED
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -26,6 +26,7 @@ en:
|
|
26
26
|
eob_index_symbols_group: Symbols
|
27
27
|
review_exercises: Review Exercises
|
28
28
|
section_exercises: ! 'Section %{number} Exercises'
|
29
|
+
iframe_link_text: Click to view content
|
29
30
|
eoc:
|
30
31
|
glossary: Key Terms
|
31
32
|
key-equations: Key Equations
|
@@ -33,3 +34,4 @@ en:
|
|
33
34
|
further-research: Further Research
|
34
35
|
key-concepts: Key Concepts
|
35
36
|
references: References
|
37
|
+
solutions: Solutions
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_kitchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -282,6 +282,7 @@ files:
|
|
282
282
|
- lib/kitchen/directions/bake_math_in_paragraph.rb
|
283
283
|
- lib/kitchen/directions/bake_non_introduction_pages.rb
|
284
284
|
- lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
|
285
|
+
- lib/kitchen/directions/bake_notes/bake_note_iframes.rb
|
285
286
|
- lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
|
286
287
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb
|
287
288
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb
|