openstax_kitchen 18.0.0 → 19.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -3
- data/lib/kitchen/directions/bake_references/v1.rb +4 -4
- data/lib/kitchen/directions/bake_screenreader_spans.rb +39 -5
- data/lib/kitchen/directions/bake_toc.rb +6 -3
- data/lib/kitchen/directions/move_solutions_to_answer_key/answer_key_cleaner.rb +19 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +7 -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: 8ad3abbaf8b72b698a5c8d16136f6d6ec9662c82c12291a7c7f87d02eafc0805
|
4
|
+
data.tar.gz: 948a85a3659dd95502113d351cbeb5a3cbc0b2c0151806974c69978818f622f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 619c09628f6d62413fd07a7ee4e732cff9f52e78363a2f3414a11f9bbb3f32a008695fb4eaa25f82f0bc8cd81354ebc9e8666973904dd9f5ae2367a6183fde5c
|
7
|
+
data.tar.gz: f1b1198cdf3d84544fdd0af0fafa5bb17a0b15a273fb801ea5a4a345a7812da2e0de5311292e5b1e05a4d11715f6564ef817ff07ae5450a23f4397483ba45254
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [19.0.0] - 2022-1-28
|
10
|
+
|
11
|
+
* Add features to `BakeScreenreaderSpans` & use translations instead of plaintext (minor)
|
12
|
+
* Create `AnswerKeyCleaner` to remove empty chapter containers (minor)
|
13
|
+
* Change markup to `span` with `sup` for reference link separator `BakeReferences.v1` plus remove whitespaces and new lines (patch)
|
14
|
+
* Changes to `BakeScreenreaderSpans` behavior (major)
|
15
|
+
* Changes to `BakeToc` to improve error messaging by including `page.id` (minor)
|
9
16
|
|
10
17
|
## [18.0.0] - 2022-01-14
|
11
18
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openstax_kitchen (
|
4
|
+
openstax_kitchen (19.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.11.
|
102
|
+
twitter_cldr (6.11.1)
|
103
103
|
camertron-eprun
|
104
104
|
cldr-plurals-runtime-rb (~> 1.1)
|
105
105
|
tzinfo
|
@@ -107,7 +107,7 @@ GEM
|
|
107
107
|
concurrent-ruby (~> 1.0)
|
108
108
|
unicode-display_width (1.7.0)
|
109
109
|
yard (0.9.24)
|
110
|
-
zeitwerk (2.5.
|
110
|
+
zeitwerk (2.5.4)
|
111
111
|
|
112
112
|
PLATFORMS
|
113
113
|
ruby
|
@@ -8,7 +8,7 @@ module Kitchen::Directions::BakeReferences
|
|
8
8
|
book.chapters.each do |chapter|
|
9
9
|
chapter.search('[data-type="cite"]').each do |link|
|
10
10
|
link.prepend(child:
|
11
|
-
<<~HTML
|
11
|
+
<<~HTML.chomp
|
12
12
|
<sup class="os-citation-number">#{link.count_in(:chapter)}</sup>
|
13
13
|
HTML
|
14
14
|
)
|
@@ -21,10 +21,10 @@ module Kitchen::Directions::BakeReferences
|
|
21
21
|
next unless link_sibling&.raw&.attr('data-type') == 'cite'
|
22
22
|
|
23
23
|
link.prepend(sibling:
|
24
|
-
<<~HTML
|
25
|
-
<span class="os-reference-link-separator">, </span>
|
24
|
+
<<~HTML.strip.chomp
|
25
|
+
<span class="os-reference-link-separator"><sup>, </sup></span>
|
26
26
|
HTML
|
27
|
-
|
27
|
+
)
|
28
28
|
end
|
29
29
|
|
30
30
|
chapter.references.each do |reference|
|
@@ -6,17 +6,51 @@ module Kitchen
|
|
6
6
|
# Add text for accessibility.
|
7
7
|
# Additional screenreader spans can be added below.
|
8
8
|
def self.v1(book:)
|
9
|
+
book.search('u[data-effect="underline"]').each do |element|
|
10
|
+
add_screenreader_text(
|
11
|
+
element: element,
|
12
|
+
begin_message: I18n.t(:'screenreader.underline'),
|
13
|
+
end_message: "#{I18n.t(:'screenreader.end')} #{I18n.t(:'screenreader.underline')}"
|
14
|
+
)
|
15
|
+
end
|
9
16
|
book.search('u[data-effect="double-underline"]').each do |element|
|
10
|
-
|
11
|
-
|
17
|
+
add_screenreader_text(
|
18
|
+
element: element,
|
19
|
+
begin_message: I18n.t(:'screenreader.double-underline'),
|
20
|
+
end_message: "#{I18n.t(:'screenreader.end')} #{I18n.t(:'screenreader.double-underline')}"
|
12
21
|
)
|
13
22
|
end
|
14
|
-
book.search('
|
15
|
-
|
16
|
-
|
23
|
+
book.search('p.public-domain').each do |element|
|
24
|
+
add_screenreader_text(
|
25
|
+
element: element,
|
26
|
+
begin_message: I18n.t(:'screenreader.public-domain'),
|
27
|
+
end_message: "#{I18n.t(:'screenreader.end')} #{I18n.t(:'screenreader.public-domain')}"
|
28
|
+
)
|
29
|
+
end
|
30
|
+
book.search('p.student-sample').each do |element|
|
31
|
+
add_screenreader_text(
|
32
|
+
element: element,
|
33
|
+
begin_message: I18n.t(:'screenreader.student-sample'),
|
34
|
+
end_message: "#{I18n.t(:'screenreader.end')} #{I18n.t(:'screenreader.student-sample')}"
|
35
|
+
)
|
36
|
+
end
|
37
|
+
book.search('p.annotation-text').each do |element|
|
38
|
+
add_screenreader_text(
|
39
|
+
element: element,
|
40
|
+
begin_message: I18n.t(:'screenreader.annotation-text'),
|
41
|
+
end_message: "#{I18n.t(:'screenreader.end')} #{I18n.t(:'screenreader.annotation-text')}"
|
17
42
|
)
|
18
43
|
end
|
19
44
|
end
|
45
|
+
|
46
|
+
def self.add_screenreader_text(element:, begin_message:, end_message:)
|
47
|
+
element.prepend(child:
|
48
|
+
"<span data-screenreader-only=\"true\">#{begin_message}</span>"
|
49
|
+
)
|
50
|
+
element.append(child:
|
51
|
+
"<span data-screenreader-only=\"true\">#{end_message}</span>"
|
52
|
+
)
|
53
|
+
end
|
20
54
|
end
|
21
55
|
end
|
22
56
|
end
|
@@ -100,7 +100,8 @@ module Kitchen
|
|
100
100
|
page.has_ancestor?(:composite_chapter)
|
101
101
|
'os-toc-unit-page'
|
102
102
|
else
|
103
|
-
raise "
|
103
|
+
raise "could not detect which page type class to apply for page.id `#{page.id}`
|
104
|
+
during baking the TOC. The classes on the page are: `#{page.classes}`"
|
104
105
|
end
|
105
106
|
when CompositePageElement
|
106
107
|
if page.is_index? || page.is_index_of_type?
|
@@ -112,10 +113,12 @@ module Kitchen
|
|
112
113
|
elsif page.has_ancestor?(:composite_chapter) || page.has_ancestor?(:chapter)
|
113
114
|
'os-toc-chapter-composite-page'
|
114
115
|
else
|
115
|
-
raise "
|
116
|
+
raise "could not detect which composite page type class to apply to TOC for page id \
|
117
|
+
`#{page.id}` during baking the TOC. The classes on the page are: `#{page.classes}`"
|
116
118
|
end
|
117
119
|
else
|
118
|
-
raise(ArgumentError, "
|
120
|
+
raise(ArgumentError, "could not detect any page type class to apply for `#{page.id}` \
|
121
|
+
during baking TOC")
|
119
122
|
end
|
120
123
|
|
121
124
|
title = page.title.copy
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::AnswerKeyCleaner
|
4
|
+
def self.v1(book:)
|
5
|
+
V1.new.bake(book: book)
|
6
|
+
end
|
7
|
+
|
8
|
+
class V1
|
9
|
+
renderable
|
10
|
+
|
11
|
+
def bake(book:)
|
12
|
+
answer_key_chapters = book.search(
|
13
|
+
'.os-eob[data-type="composite-chapter"] > [data-type="composite-page"]')
|
14
|
+
answer_key_chapters.each do |container|
|
15
|
+
container.trash unless container.contains?('[data-type="solution"]')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -61,3 +61,10 @@ en:
|
|
61
61
|
title: Auditory learning style icon
|
62
62
|
kinesthetic-icon:
|
63
63
|
title: Kinesthetic learning style icon
|
64
|
+
screenreader:
|
65
|
+
end: end
|
66
|
+
underline: underline
|
67
|
+
double-underline: double underline
|
68
|
+
public-domain: public domain text
|
69
|
+
student-sample: student sample text
|
70
|
+
annotation-text: annotated text
|
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:
|
4
|
+
version: 19.0.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: 2022-01-
|
11
|
+
date: 2022-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -359,6 +359,7 @@ files:
|
|
359
359
|
- lib/kitchen/directions/move_exercises_to_eoc/v1.rb
|
360
360
|
- lib/kitchen/directions/move_exercises_to_eoc/v2.rb
|
361
361
|
- lib/kitchen/directions/move_exercises_to_eoc/v3.rb
|
362
|
+
- lib/kitchen/directions/move_solutions_to_answer_key/answer_key_cleaner.rb
|
362
363
|
- lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
|
363
364
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_exercise_section.rb
|
364
365
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
|