openstax_kitchen 7.0.0 → 8.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 +12 -4
- data/Gemfile.lock +2 -2
- data/lib/kitchen/composite_page_element.rb +2 -2
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +23 -5
- data/lib/kitchen/directions/bake_example.rb +7 -1
- data/lib/kitchen/element_base.rb +2 -2
- data/lib/kitchen/i18n_string.rb +16 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/es.yml +1 -1
- data/lib/locales/pl.yml +1 -1
- data/lib/openstax_kitchen.rb +1 -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: 46fe1771e5853e9149dc1df841fafeaba3d3b157ab850d66f94745406867d901
|
4
|
+
data.tar.gz: 1f97e7a288fb5a9c7c96c3f9352238736ac9854a8b0a06379328253f89e9552f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a8b103ba036bd0db84ad87857873ff3f6c048c03951e6e5543577330df875025a97338c62b96f6278ca751be81a04be3e95ef6468458fed086e3bdad7adcc3
|
7
|
+
data.tar.gz: ff6c97185d2c264019fe041e17b83678c12f1f894bef9c0d11d01eab304b6a9c3200c2c9e03405267dc462a52775d78b44daa0050a9002ac1ea6bfef1998f111
|
data/CHANGELOG.md
CHANGED
@@ -7,11 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
9
|
|
10
|
+
## [8.0.0] - 2021-06-29
|
11
|
+
|
12
|
+
* Sort terms in `BakeChapterGlossary` in language specific way (major)
|
13
|
+
* Spanish translation change (minor)
|
14
|
+
* Fixed the implementation of `Element#wrap_children` to reuse existing document elements (major).
|
15
|
+
|
10
16
|
## [7.0.0] - 2021-06-21
|
11
17
|
|
12
18
|
* Changed selector expected by `default strategy` in `move_solutions_to_answer_key` to optimize search (major)
|
13
19
|
* Fix Rubocop GitHub Action's regular expression used to select files to lint (patch)
|
20
|
+
* Add optional numbering to multiple solutions inside examples (minor)
|
14
21
|
* Added monkey patch for array to be able to add a prefix: `%w[multiple-choice true-false].prefix('section.')` (minor)
|
22
|
+
* Add more specific book part selector (`os-eob`) for References in `is_citation_reference?`, `is_section_reference?` methods in `Element Base` to fix toc selector for References which are moved to EoC (major)
|
15
23
|
|
16
24
|
## [6.1.0] - 2021-06-21
|
17
25
|
|
@@ -45,10 +53,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
45
53
|
* Adds `BakeNumberedNotes` V3 (minor)
|
46
54
|
* Added line that puts the classname `has-footnote` in the footnote ref's parent element (major)
|
47
55
|
* Added a condition into `BakeChapterSummary` so it doesn't bake the title if it already includes the respective number in it
|
48
|
-
* Create v3 of MoveExercisesToEOC which differs from v1 by the presence of a section title
|
49
|
-
and from v2 the lack of additional
|
50
|
-
* Add a condition in BakeNumberedExercise to make it possible to suppress even solutions in the Answer Key (minor)
|
51
|
-
* Fix BakeFurtherResearch baking with main bake script error by breaking the loop if further research sections are not present (minor)
|
56
|
+
* Create v3 of `MoveExercisesToEOC` which differs from v1 by the presence of a section title
|
57
|
+
and from v2 the lack of additional `os-section-area` and `os-#{@klass} wrapper` (minor)
|
58
|
+
* Add a condition in `BakeNumberedExercise` to make it possible to suppress even solutions in the Answer Key (minor)
|
59
|
+
* Fix `BakeFurtherResearch` baking with main bake script error by breaking the loop if further research sections are not present (minor)
|
52
60
|
* Rework v1 of `BakeChapterReferences` to bake references also from introduction pages (major)
|
53
61
|
* 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)
|
54
62
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openstax_kitchen (
|
4
|
+
openstax_kitchen (8.0.0)
|
5
5
|
activesupport
|
6
6
|
i18n
|
7
7
|
nokogiri
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (6.1.
|
14
|
+
activesupport (6.1.4)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 1.6, < 2)
|
17
17
|
minitest (>= 5.1)
|
@@ -57,7 +57,7 @@ module Kitchen
|
|
57
57
|
# @return [Boolean]
|
58
58
|
#
|
59
59
|
def is_citation_reference?
|
60
|
-
has_class?('os-reference-container')
|
60
|
+
has_class?('os-eob os-reference-container')
|
61
61
|
end
|
62
62
|
|
63
63
|
# Returns true if this page is a book section reference
|
@@ -65,7 +65,7 @@ module Kitchen
|
|
65
65
|
# @return [Boolean]
|
66
66
|
#
|
67
67
|
def is_section_reference?
|
68
|
-
has_class?('os-references-container')
|
68
|
+
has_class?('os-eob os-references-container')
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -4,21 +4,39 @@ module Kitchen::Directions::BakeChapterGlossary
|
|
4
4
|
class V1
|
5
5
|
renderable
|
6
6
|
|
7
|
+
class Definition
|
8
|
+
attr_reader :element
|
9
|
+
|
10
|
+
def initialize(element)
|
11
|
+
term = Kitchen::I18nString.new(element.first('dt').text.downcase)
|
12
|
+
description = Kitchen::I18nString.new(element.first('dd').text.downcase)
|
13
|
+
@sortable = [term, description]
|
14
|
+
@element = element
|
15
|
+
end
|
16
|
+
|
17
|
+
def <=>(other)
|
18
|
+
sortable <=> other.sortable
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
attr_reader :sortable
|
24
|
+
end
|
25
|
+
|
7
26
|
def bake(chapter:, metadata_source:, append_to: nil, uuid_prefix: '')
|
8
27
|
@metadata = metadata_source.children_to_keep.copy
|
9
28
|
@klass = 'glossary'
|
10
29
|
@title = I18n.t(:eoc_key_terms_title)
|
11
30
|
@uuid_prefix = uuid_prefix
|
31
|
+
@glossary = []
|
12
32
|
|
13
|
-
|
14
|
-
|
15
|
-
definitions.sort_by! do |definition|
|
16
|
-
[definition.first('dt').text.downcase, definition.first('dd').text.downcase]
|
33
|
+
chapter.glossaries.search('dl').each do |definition_element|
|
34
|
+
@glossary.push(Definition.new(definition_element.cut))
|
17
35
|
end
|
18
36
|
|
19
37
|
chapter.glossaries.trash
|
20
38
|
|
21
|
-
@content =
|
39
|
+
@content = @glossary.sort.map { |definition| definition.element.paste }.join
|
22
40
|
|
23
41
|
append_to_element = append_to || chapter
|
24
42
|
@in_composite_chapter = append_to_element.is?(:composite_chapter)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Kitchen
|
4
4
|
module Directions
|
5
5
|
module BakeExample
|
6
|
-
def self.v1(example:, number:, title_tag:)
|
6
|
+
def self.v1(example:, number:, title_tag:, numbered_solutions: false)
|
7
7
|
example.wrap_children(class: 'body')
|
8
8
|
|
9
9
|
example.prepend(child:
|
@@ -36,10 +36,16 @@ module Kitchen
|
|
36
36
|
end
|
37
37
|
|
38
38
|
if (solution = exercise.solution)
|
39
|
+
solution_number = if numbered_solutions
|
40
|
+
"<span class=\"os-number\">#{exercise.count_in(:example)}</span>"
|
41
|
+
else
|
42
|
+
''
|
43
|
+
end
|
39
44
|
solution.replace_children(with:
|
40
45
|
<<~HTML
|
41
46
|
<h4 data-type="solution-title">
|
42
47
|
<span class="os-title-label">#{I18n.t(:solution)} </span>
|
48
|
+
#{solution_number}
|
43
49
|
</h4>
|
44
50
|
<div class="os-solution-container">#{solution.children}</div>
|
45
51
|
HTML
|
data/lib/kitchen/element_base.rb
CHANGED
@@ -602,9 +602,9 @@ module Kitchen
|
|
602
602
|
attributes.each do |k, v|
|
603
603
|
new_node[k.to_s.gsub(/([^_])_([^_])/, '\1-\2').gsub('__', '_')] = v
|
604
604
|
end
|
605
|
-
new_node.children = children
|
605
|
+
new_node.children = children
|
606
606
|
yield Element.new(node: new_node, document: document, short_type: nil) if block_given?
|
607
|
-
end
|
607
|
+
end
|
608
608
|
|
609
609
|
self
|
610
610
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# Compare one string with another
|
5
|
+
#
|
6
|
+
# Returns 0 if first string equals second,
|
7
|
+
# 1 if first string is greater than the second
|
8
|
+
# and -1 if first string is less than the second.
|
9
|
+
#
|
10
|
+
class I18nString < String
|
11
|
+
|
12
|
+
def <=>(other)
|
13
|
+
I18n.sort_strings(self, other)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/es.yml
CHANGED
@@ -16,7 +16,7 @@ es:
|
|
16
16
|
learning_objectives: Objetivos De Aprendizaje
|
17
17
|
stepwise_step_label: Paso
|
18
18
|
references: Referencias
|
19
|
-
answer_key_title: Respuestas
|
19
|
+
answer_key_title: Clave de Respuestas
|
20
20
|
eoc_chapter_review: Revisión Del Capítulo
|
21
21
|
eoc_key_terms_title: Términos Clave
|
22
22
|
eoc_summary_title: Resumen
|
data/lib/locales/pl.yml
CHANGED
@@ -16,7 +16,7 @@ pl:
|
|
16
16
|
stepwise_step_label: Krok
|
17
17
|
answer_key_title: Rozwiązania zadań
|
18
18
|
eoc_chapter_review: Podsumowanie rozdziału
|
19
|
-
|
19
|
+
eoc_key_terms_title: Kluczowe pojęcia
|
20
20
|
eoc_solutions_title: Rozwiązania
|
21
21
|
eoc_summary_title: Podsumowanie
|
22
22
|
eoc_key_equations: Najważniejsze wzory
|
data/lib/openstax_kitchen.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:
|
4
|
+
version: 8.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: 2021-06-
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -339,6 +339,7 @@ files:
|
|
339
339
|
- lib/kitchen/exercise_element_enumerator.rb
|
340
340
|
- lib/kitchen/figure_element.rb
|
341
341
|
- lib/kitchen/figure_element_enumerator.rb
|
342
|
+
- lib/kitchen/i18n_string.rb
|
342
343
|
- lib/kitchen/id_tracker.rb
|
343
344
|
- lib/kitchen/metadata_element.rb
|
344
345
|
- lib/kitchen/metadata_element_enumerator.rb
|