openstax_kitchen 12.0.0 → 12.1.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 +1 -1
- data/lib/kitchen/directions/bake_figure.rb +3 -2
- data/lib/kitchen/element_base.rb +8 -0
- data/lib/kitchen/example_element.rb +2 -1
- data/lib/kitchen/figure_element.rb +1 -1
- data/lib/kitchen/metadata_element.rb +6 -1
- data/lib/kitchen/note_element.rb +13 -5
- data/lib/kitchen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28254d4a9107528ff5dbebacc82e5cc3cbf20e71fcc9d8303c2f41fd90d2d4be
|
4
|
+
data.tar.gz: 2c71714f62fe45ea772614d5c72f6a95ce59deebc63e1259b182e25d70481400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfaf9123a29ef2bedddb524ed7758b1092c88c6cbc850aeee0d4530633783ab2cbec39b68f3b5fc391219f344f191c4714f779ef8efc57c7f35c47d075eb813e
|
7
|
+
data.tar.gz: c686d00ca4305b0f90f23c4ba2cfb3151a5c0384f7979e82fe16d5432a9e79b32705822aeae244601343d3620e053247b848edf78631c59f93a920e312d7951d
|
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
|
+
## [12.1.0] - 2021-09-24
|
10
|
+
|
11
|
+
* Fix `BakeExample#titles_to_rename` to exclude exercise titles (patch)
|
12
|
+
* Modify `BakeFigure` to bake unnumbered figures with caption (minor)
|
13
|
+
* Fix `NoteElement#title` to be more specific about finding the title (patch)
|
14
|
+
* Adds `data-type="slug"` to `metadata_lement` `children_to_keep` method, updates spec helper `metadata_element` and related spec files(minor)
|
15
|
+
|
9
16
|
## [12.0.0] - 2021-09-21
|
10
17
|
|
11
18
|
* Fixes `BakeStepwise` to skip nested lists (patch)
|
data/Gemfile.lock
CHANGED
@@ -4,10 +4,11 @@ module Kitchen
|
|
4
4
|
module Directions
|
5
5
|
module BakeFigure
|
6
6
|
def self.v1(figure:, number:, cases: false)
|
7
|
-
return if figure.has_class?('unnumbered') && !figure.has_class?('splash')
|
7
|
+
return if figure.has_class?('unnumbered') && !figure.has_class?('splash') && !figure.caption
|
8
8
|
|
9
9
|
figure.wrap(%(<div class="os-figure#{' has-splash' if figure.has_class?('splash')}">))
|
10
|
-
|
10
|
+
|
11
|
+
if figure.has_class?('unnumbered') && (figure.caption || figure.has_class?('splash'))
|
11
12
|
caption = figure.caption&.cut
|
12
13
|
figure.append(sibling:
|
13
14
|
<<~HTML
|
data/lib/kitchen/element_base.rb
CHANGED
@@ -211,6 +211,14 @@ module Kitchen
|
|
211
211
|
self[:id] = value
|
212
212
|
end
|
213
213
|
|
214
|
+
# Returns the element's data-type
|
215
|
+
#
|
216
|
+
# @return [String]
|
217
|
+
#
|
218
|
+
def data_type
|
219
|
+
self[:'data-type']
|
220
|
+
end
|
221
|
+
|
214
222
|
# A way to set values and chain them
|
215
223
|
#
|
216
224
|
# @param property [String, Symbol] the name of the property to set
|
@@ -33,7 +33,8 @@ module Kitchen
|
|
33
33
|
title.parent.has_class?('os-caption-container') || \
|
34
34
|
title.parent.has_class?('os-caption') || \
|
35
35
|
title.parent.name == 'caption' || \
|
36
|
-
title.parent
|
36
|
+
title.parent.data_type == 'note' || \
|
37
|
+
title.parent.data_type == 'exercise'
|
37
38
|
end
|
38
39
|
)
|
39
40
|
end
|
@@ -53,7 +53,7 @@ module Kitchen
|
|
53
53
|
# @return [Boolean]
|
54
54
|
#
|
55
55
|
def figure_to_bake?
|
56
|
-
return false if subfigure? || (has_class?('unnumbered') && !has_class?('splash'))
|
56
|
+
return false if subfigure? || (has_class?('unnumbered') && !has_class?('splash') && !caption)
|
57
57
|
|
58
58
|
true
|
59
59
|
end
|
@@ -27,7 +27,12 @@ module Kitchen
|
|
27
27
|
# @return [ElementEnumerator]
|
28
28
|
#
|
29
29
|
def children_to_keep
|
30
|
-
search(%w(span[data-type='revised']
|
30
|
+
search(%w(span[data-type='revised']
|
31
|
+
span[data-type='slug']
|
32
|
+
div.authors
|
33
|
+
div.publishers
|
34
|
+
div.print-style
|
35
|
+
div.permissions
|
31
36
|
div[data-type='subject']))
|
32
37
|
end
|
33
38
|
end
|
data/lib/kitchen/note_element.rb
CHANGED
@@ -29,16 +29,24 @@ module Kitchen
|
|
29
29
|
#
|
30
30
|
def title
|
31
31
|
block_error_if(block_given?)
|
32
|
-
|
33
|
-
|
32
|
+
# An element with data-type="title" is ambiguous; it is only the note's title if:
|
33
|
+
# 1. it is the note body's first child
|
34
|
+
# 2. it is the first child's first child and the first child is a paragraph
|
35
|
+
first_child = first_note_body_child
|
36
|
+
first_grandchild = first_child&.element_children&.[](0) if first_child.name == 'p'
|
34
37
|
|
35
|
-
if first_child
|
38
|
+
if first_child.data_type == 'title'
|
36
39
|
first_child
|
37
|
-
elsif
|
38
|
-
|
40
|
+
elsif first_grandchild&.data_type == 'title'
|
41
|
+
first_grandchild
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
45
|
+
def first_note_body_child
|
46
|
+
note_body = first('div.os-note-body')
|
47
|
+
note_body ? note_body.element_children[0] : element_children[0]
|
48
|
+
end
|
49
|
+
|
42
50
|
# Returns true if the note's title is autogenerated
|
43
51
|
#
|
44
52
|
# @return [Boolean]
|
data/lib/kitchen/version.rb
CHANGED
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: 12.
|
4
|
+
version: 12.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-09-
|
11
|
+
date: 2021-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -461,7 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
461
461
|
- !ruby/object:Gem::Version
|
462
462
|
version: '0'
|
463
463
|
requirements: []
|
464
|
-
rubygems_version: 3.0.3
|
464
|
+
rubygems_version: 3.0.3.1
|
465
465
|
signing_key:
|
466
466
|
specification_version: 4
|
467
467
|
summary: OpenStax content baking library
|