openstax_kitchen 6.0.0 → 6.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/.github/workflows/changelog.yml +0 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/kitchen/composite_page_element.rb +19 -2
- 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_inline_lists.rb +22 -0
- 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/version.rb +1 -1
- data/lib/locales/pl.yml +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68b22024e79d8b530195dafc0dba4b939f7c5503023ae1fbc1ee876a038595d9
|
4
|
+
data.tar.gz: 4a35e7fdbae28ecadd234c1aff6596ef61ec4aaffd4adf2a29bc401ed54b7576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d9856998c75fee77bc41b734399ffc3045a93082cba273b636b10411b852ee71f4e9bda86a38108e9293f53136194d3c85cb12ea5c92159d571c64d2b85044
|
7
|
+
data.tar.gz: d29fd215321a1ab877c16083b73bb0b872ee67c68a636425e6ef5ded5d8fd9ff7ae77599ec1d9a500e69ad627f175ac7c5fb1194310b8e0979d0cc7160403b55
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [6.1.0] - 2021-06-21
|
10
|
+
|
11
|
+
* Create a `BakeReferences` V2 for unnumbered section references (minor)
|
12
|
+
* Don't check for CHANGELOG when merge a PR to main (patch)
|
13
|
+
* Added `BakeInlineLists` (minor)
|
9
14
|
|
10
15
|
## [6.0.0] - 2021-06-15
|
11
16
|
|
@@ -37,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
37
42
|
and from v2 the lack of additional "os-section-area" and os-#{@klass} wrapper (minor)
|
38
43
|
* Add a condition in BakeNumberedExercise to make it possible to suppress even solutions in the Answer Key (minor)
|
39
44
|
* Fix BakeFurtherResearch baking with main bake script error by breaking the loop if further research sections are not present (minor)
|
45
|
+
* Rework v1 of `BakeChapterReferences` to bake references also from introduction pages (major)
|
40
46
|
* 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)
|
41
47
|
|
42
48
|
## [5.0.0] - 2021-06-02
|
data/Gemfile.lock
CHANGED
@@ -43,13 +43,30 @@ 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
|
47
56
|
#
|
48
57
|
# @return [Boolean]
|
49
58
|
#
|
50
|
-
def
|
59
|
+
def is_citation_reference?
|
51
60
|
has_class?('os-reference-container')
|
52
61
|
end
|
53
62
|
|
63
|
+
# Returns true if this page is a book section reference
|
64
|
+
#
|
65
|
+
# @return [Boolean]
|
66
|
+
#
|
67
|
+
def is_section_reference?
|
68
|
+
has_class?('os-references-container')
|
69
|
+
end
|
70
|
+
|
54
71
|
end
|
55
72
|
end
|
@@ -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
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
module Directions
|
5
|
+
# Bakes inline lists with the desired list separator
|
6
|
+
# Does not separate the last list item
|
7
|
+
#
|
8
|
+
module BakeInlineLists
|
9
|
+
LIST_SEPARATOR = '; '
|
10
|
+
SEPARATOR_CLASS = '-os-inline-list-separator'
|
11
|
+
|
12
|
+
def self.v1(book:)
|
13
|
+
inline_lists = book.search('span[data-display="inline"][data-type="list"]')
|
14
|
+
inline_lists.each do |list|
|
15
|
+
list.search('span[data-type="item"]')[0..-2].each do |item|
|
16
|
+
item.append(child: "<span class=\"#{SEPARATOR_CLASS}\">#{LIST_SEPARATOR}</span>")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen::Directions::BakeReferences
|
4
|
+
class V2
|
5
|
+
renderable
|
6
|
+
|
7
|
+
def bake(book:, metadata_source:)
|
8
|
+
@metadata = metadata_source.children_to_keep.copy
|
9
|
+
@klass = 'references'
|
10
|
+
@uuid_prefix = '.'
|
11
|
+
@title = I18n.t(:references)
|
12
|
+
|
13
|
+
book.chapters.each do |chapter|
|
14
|
+
|
15
|
+
chapter.references.search('h3').trash
|
16
|
+
|
17
|
+
chapter_references = chapter.pages.references.cut
|
18
|
+
chapter_title_no_num = chapter.title.search('.os-text')
|
19
|
+
|
20
|
+
chapter.append(child:
|
21
|
+
<<~HTML
|
22
|
+
<div class="os-chapter-area">
|
23
|
+
<h2 data-type="document-title">#{chapter_title_no_num}</h2>
|
24
|
+
#{chapter_references.paste}
|
25
|
+
</div>
|
26
|
+
HTML
|
27
|
+
)
|
28
|
+
end
|
29
|
+
chapter_area_references = book.chapters.search('.os-chapter-area').cut
|
30
|
+
@content = chapter_area_references.paste
|
31
|
+
book.body.append(child: render(file:
|
32
|
+
'../../templates/eob_section_title_template.xhtml.erb'))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -96,8 +96,10 @@ module Kitchen
|
|
96
96
|
when CompositePageElement
|
97
97
|
if page.is_index?
|
98
98
|
'os-toc-index'
|
99
|
-
elsif page.
|
99
|
+
elsif page.is_citation_reference?
|
100
100
|
'os-toc-reference'
|
101
|
+
elsif page.is_section_reference?
|
102
|
+
'os-toc-references'
|
101
103
|
elsif page.has_ancestor?(:composite_chapter) || page.has_ancestor?(:chapter)
|
102
104
|
'os-toc-chapter-composite-page'
|
103
105
|
else
|
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/pl.yml
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: 6.
|
4
|
+
version: 6.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-06-
|
11
|
+
date: 2021-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/kitchen/directions/bake_index/main.rb
|
277
277
|
- lib/kitchen/directions/bake_index/v1.rb
|
278
278
|
- lib/kitchen/directions/bake_index/v1.xhtml.erb
|
279
|
+
- lib/kitchen/directions/bake_inline_lists.rb
|
279
280
|
- lib/kitchen/directions/bake_link_placeholders.rb
|
280
281
|
- lib/kitchen/directions/bake_math_in_paragraph.rb
|
281
282
|
- lib/kitchen/directions/bake_non_introduction_pages.rb
|
@@ -297,6 +298,7 @@ files:
|
|
297
298
|
- lib/kitchen/directions/bake_preface/v1.rb
|
298
299
|
- lib/kitchen/directions/bake_references/main.rb
|
299
300
|
- lib/kitchen/directions/bake_references/v1.rb
|
301
|
+
- lib/kitchen/directions/bake_references/v2.rb
|
300
302
|
- lib/kitchen/directions/bake_stepwise.rb
|
301
303
|
- lib/kitchen/directions/bake_suggested_reading.rb
|
302
304
|
- lib/kitchen/directions/bake_theorem/main.rb
|