openstax_kitchen 11.0.0 → 11.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 +21 -0
- data/Gemfile.lock +1 -1
- data/lib/kitchen/composite_page_element.rb +8 -0
- data/lib/kitchen/directions/bake_chapter_introductions/bake_chapter_objectives.rb +46 -0
- data/lib/kitchen/directions/bake_chapter_introductions/bake_chapter_outline.rb +14 -0
- data/lib/kitchen/directions/bake_chapter_introductions/main.rb +43 -0
- data/lib/kitchen/directions/bake_chapter_introductions/v1.rb +56 -0
- data/lib/kitchen/directions/bake_chapter_introductions/v2.rb +91 -0
- data/lib/kitchen/directions/bake_custom_sections/main.rb +14 -0
- data/lib/kitchen/directions/bake_custom_sections/v1.rb +42 -0
- data/lib/kitchen/directions/bake_equations.rb +2 -3
- data/lib/kitchen/directions/bake_example.rb +4 -5
- data/lib/kitchen/directions/bake_figure.rb +5 -3
- data/lib/kitchen/directions/bake_iframes/main.rb +11 -0
- data/lib/kitchen/directions/bake_iframes/v1.rb +25 -0
- data/lib/kitchen/directions/bake_index/main.rb +2 -2
- data/lib/kitchen/directions/bake_index/v1.rb +39 -7
- data/lib/kitchen/directions/bake_index/v1.xhtml.erb +3 -3
- data/lib/kitchen/directions/bake_injected_exercise.rb +18 -0
- data/lib/kitchen/directions/bake_injected_exercise_question.rb +71 -0
- data/lib/kitchen/directions/bake_link_placeholders.rb +15 -2
- data/lib/kitchen/directions/bake_lists_with_para.rb +3 -3
- data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +5 -5
- data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +6 -2
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +13 -3
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +29 -25
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +22 -17
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +27 -22
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +3 -2
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +6 -24
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +3 -3
- data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -4
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +3 -3
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +3 -3
- data/lib/kitchen/directions/bake_toc.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_exercise_section.rb +1 -7
- data/lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb +1 -7
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb +17 -0
- data/lib/kitchen/element_base.rb +38 -2
- data/lib/kitchen/element_enumerator_base.rb +35 -0
- data/lib/kitchen/injected_question_element.rb +77 -0
- data/lib/kitchen/injected_question_element_enumerator.rb +21 -0
- data/lib/kitchen/selectors/base.rb +6 -0
- data/lib/kitchen/selectors/standard_1.rb +3 -0
- data/lib/kitchen/solution_element_enumerator.rb +21 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +6 -4
- data/lib/locales/es.yml +5 -4
- data/lib/locales/pl.yml +52 -7
- metadata +17 -6
- data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
- data/lib/kitchen/directions/bake_chapter_introductions.rb +0 -65
- data/lib/kitchen/directions/bake_notes/bake_note_iframes.rb +0 -27
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An enumerator for example elements
|
5
|
+
#
|
6
|
+
class InjectedQuestionElementEnumerator < ElementEnumeratorBase
|
7
|
+
|
8
|
+
# Returns a factory for this enumerator
|
9
|
+
#
|
10
|
+
# @return [ElementEnumeratorFactory]
|
11
|
+
#
|
12
|
+
def self.factory
|
13
|
+
ElementEnumeratorFactory.new(
|
14
|
+
default_css_or_xpath: Selector.named(:injected_question),
|
15
|
+
sub_element_class: InjectedQuestionElement,
|
16
|
+
enumerator_class: self
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -56,6 +56,12 @@ module Kitchen
|
|
56
56
|
# Selector for an unit
|
57
57
|
# @return [String]
|
58
58
|
attr_accessor :unit
|
59
|
+
# Selector for an unit
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :solution
|
62
|
+
# Selector for an injected question
|
63
|
+
# @return [String]
|
64
|
+
attr_accessor :injected_question
|
59
65
|
|
60
66
|
# Override specific selectors
|
61
67
|
#
|
@@ -26,6 +26,9 @@ module Kitchen
|
|
26
26
|
self.example = "div[data-type='example']"
|
27
27
|
self.exercise = "div[data-type='exercise']"
|
28
28
|
self.unit = "div[data-type='unit']"
|
29
|
+
self.solution = "div[data-type='solution'], " \
|
30
|
+
"div[data-type='question-solution']"
|
31
|
+
self.injected_question = "div[data-type='exercise-question']"
|
29
32
|
end
|
30
33
|
|
31
34
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An enumerator for table elements
|
5
|
+
#
|
6
|
+
class SolutionElementEnumerator < ElementEnumeratorBase
|
7
|
+
|
8
|
+
# Returns a factory for this enumerator
|
9
|
+
#
|
10
|
+
# @return [ElementEnumeratorFactory]
|
11
|
+
#
|
12
|
+
def self.factory
|
13
|
+
ElementEnumeratorFactory.new(
|
14
|
+
default_css_or_xpath: Selector.named(:solution),
|
15
|
+
sub_element_class: Element,
|
16
|
+
enumerator_class: self
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
en:
|
2
2
|
figure: Figure
|
3
|
-
|
3
|
+
table: Table
|
4
4
|
appendix: Appendix
|
5
5
|
theorem: Theorem
|
6
6
|
solution: Solution
|
7
7
|
chapter_outline: Chapter Outline
|
8
8
|
toc_title: Contents
|
9
|
-
|
10
|
-
|
9
|
+
example: Example
|
10
|
+
exercise: Exercise
|
11
11
|
equation: Equation
|
12
12
|
chapter: Chapter
|
13
13
|
unit: Unit
|
@@ -22,7 +22,6 @@ en:
|
|
22
22
|
eoc_composite_metadata_title: Chapter Review
|
23
23
|
eoc_solutions_title: Solutions
|
24
24
|
eoc_suggested_reading: Suggestions for Further Study
|
25
|
-
eob_index_title: Index
|
26
25
|
eob_index_symbols_group: Symbols
|
27
26
|
review_exercises: Review Exercises
|
28
27
|
section_exercises: ! 'Section %{number} Exercises'
|
@@ -36,6 +35,9 @@ en:
|
|
36
35
|
key-concepts: Key Concepts
|
37
36
|
references: References
|
38
37
|
solutions: Solutions
|
38
|
+
section-exercises: ! 'Section %{number} Exercises'
|
39
39
|
folio:
|
40
40
|
preface: Preface
|
41
41
|
access_for_free: Access for free at openstax.org
|
42
|
+
index:
|
43
|
+
main: Index
|
data/lib/locales/es.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
es:
|
2
2
|
figure: Figura
|
3
|
-
|
3
|
+
table: Tabla
|
4
4
|
appendix: Apéndice
|
5
5
|
theorem: Teorema
|
6
6
|
solution: Solución
|
7
7
|
chapter_outline: Esquema Del Capitulo
|
8
8
|
toc_title: Contenido
|
9
|
-
|
10
|
-
|
9
|
+
example: Ejemplo
|
10
|
+
exercise: Ejercicio
|
11
11
|
equation: Ecuación
|
12
12
|
chapter: Capítulo
|
13
13
|
unit: Unidad
|
@@ -23,7 +23,6 @@ es:
|
|
23
23
|
eoc_solutions_title: Soluciones
|
24
24
|
eoc_key_concepts: Conceptos Clave
|
25
25
|
eoc_suggested_reading: Sugerencias Para Estudios Adicionales
|
26
|
-
eob_index_title: Índice
|
27
26
|
eob_index_symbols_group: Símbolos
|
28
27
|
review_exercises: Ejercicios De Repaso
|
29
28
|
section_exercises: ! 'Sección %{number} Ejercicios'
|
@@ -36,3 +35,5 @@ es:
|
|
36
35
|
folio:
|
37
36
|
preface: Prefacio
|
38
37
|
access_for_free: Acceso gratis en openstax.org
|
38
|
+
index:
|
39
|
+
main: Índice
|
data/lib/locales/pl.yml
CHANGED
@@ -1,14 +1,57 @@
|
|
1
1
|
pl:
|
2
|
-
figure:
|
3
|
-
|
2
|
+
figure:
|
3
|
+
nominative: Rysunek
|
4
|
+
genitive: Rysunku
|
5
|
+
dative: Rysunkowi
|
6
|
+
accusative: Rysunek
|
7
|
+
instrumental: Rysunkiem
|
8
|
+
locative: Rysunku
|
9
|
+
vocative: Rysunku
|
10
|
+
table:
|
11
|
+
nominative: Tabela
|
12
|
+
genitive: Tabeli
|
13
|
+
dative: Tabeli
|
14
|
+
accusative: Tabelę
|
15
|
+
instrumental: Tabelą
|
16
|
+
locative: Tabeli
|
17
|
+
vocative: Tabelo
|
18
|
+
example:
|
19
|
+
nominative: Przykład
|
20
|
+
genitive: Przykładu
|
21
|
+
dative: Przykładowi
|
22
|
+
accusative: Przykład
|
23
|
+
instrumental: Przykładem
|
24
|
+
locative: Przykładzie
|
25
|
+
vocative: Przykładzie
|
26
|
+
exercise:
|
27
|
+
nominative: Ćwiczenie
|
28
|
+
genitive: Ćwiczenia
|
29
|
+
dative: Ćwiczeniu
|
30
|
+
accusative: Ćwiczenie
|
31
|
+
instrumental: Ćwiczeniem
|
32
|
+
locative: Ćwiczeniu
|
33
|
+
vocative: Ćwiczenie
|
34
|
+
equation:
|
35
|
+
nominative: Równanie
|
36
|
+
genitive: Równania
|
37
|
+
dative: Równaniu
|
38
|
+
accusative: Równanie
|
39
|
+
instrumental: Równaniem
|
40
|
+
locative: Równaniu
|
41
|
+
vocative: Równanie
|
42
|
+
note:
|
43
|
+
nominative: Ramka
|
44
|
+
genitive: Ramki
|
45
|
+
dative: Ramce
|
46
|
+
accusative: Ramkę
|
47
|
+
instrumental: Ramką
|
48
|
+
locative: Ramce
|
49
|
+
vocative: Ramko
|
4
50
|
appendix: Dodatek
|
5
51
|
theorem: Twierdzenie
|
6
52
|
solution: Rozwiązanie
|
7
53
|
chapter_outline: Treść rozdziału
|
8
54
|
toc_title: Spis treści
|
9
|
-
example_label: Przykład
|
10
|
-
exercise_label: Ćwiczenie
|
11
|
-
equation: Równanie
|
12
55
|
chapter: Rozdział
|
13
56
|
unit: Część
|
14
57
|
chapter_review: Podsumowanie rozdziału
|
@@ -17,7 +60,6 @@ pl:
|
|
17
60
|
answer_key_title: Rozwiązania zadań
|
18
61
|
eoc_chapter_review: Podsumowanie rozdziału
|
19
62
|
eoc_solutions_title: Rozwiązania
|
20
|
-
eob_index_title: Skorowidz rzeczowy
|
21
63
|
eob_index_symbols_group: Symbole
|
22
64
|
references: Bibliografia
|
23
65
|
eoc:
|
@@ -25,4 +67,7 @@ pl:
|
|
25
67
|
key-equations: Najważniejsze wzory
|
26
68
|
summary: Podsumowanie
|
27
69
|
references: Bibliografia
|
28
|
-
|
70
|
+
index:
|
71
|
+
name: Skorowidz nazwisk
|
72
|
+
term: Skorowidz rzeczowy
|
73
|
+
foreign: Skorowidz terminów obcojęzycznych
|
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: 11.
|
4
|
+
version: 11.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-08-
|
11
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -248,8 +248,11 @@ files:
|
|
248
248
|
- lib/kitchen/directions/bake_appendix.rb
|
249
249
|
- lib/kitchen/directions/bake_chapter_glossary/main.rb
|
250
250
|
- lib/kitchen/directions/bake_chapter_glossary/v1.rb
|
251
|
-
- lib/kitchen/directions/bake_chapter_introductions.rb
|
252
|
-
- lib/kitchen/directions/bake_chapter_introductions/
|
251
|
+
- lib/kitchen/directions/bake_chapter_introductions/bake_chapter_objectives.rb
|
252
|
+
- lib/kitchen/directions/bake_chapter_introductions/bake_chapter_outline.rb
|
253
|
+
- lib/kitchen/directions/bake_chapter_introductions/main.rb
|
254
|
+
- lib/kitchen/directions/bake_chapter_introductions/v1.rb
|
255
|
+
- lib/kitchen/directions/bake_chapter_introductions/v2.rb
|
253
256
|
- lib/kitchen/directions/bake_chapter_key_concepts/main.rb
|
254
257
|
- lib/kitchen/directions/bake_chapter_key_concepts/v1.rb
|
255
258
|
- lib/kitchen/directions/bake_chapter_key_equations.rb
|
@@ -265,6 +268,8 @@ files:
|
|
265
268
|
- lib/kitchen/directions/bake_checkpoint.rb
|
266
269
|
- lib/kitchen/directions/bake_composite_chapters.rb
|
267
270
|
- lib/kitchen/directions/bake_composite_pages.rb
|
271
|
+
- lib/kitchen/directions/bake_custom_sections/main.rb
|
272
|
+
- lib/kitchen/directions/bake_custom_sections/v1.rb
|
268
273
|
- lib/kitchen/directions/bake_eoc_section_content/change_subsection_title_tag.rb
|
269
274
|
- lib/kitchen/directions/bake_eoc_section_content/remove_section_title.rb
|
270
275
|
- lib/kitchen/directions/bake_equations.rb
|
@@ -280,16 +285,19 @@ files:
|
|
280
285
|
- lib/kitchen/directions/bake_further_research.rb
|
281
286
|
- lib/kitchen/directions/bake_handbook/main.rb
|
282
287
|
- lib/kitchen/directions/bake_handbook/v1.rb
|
288
|
+
- lib/kitchen/directions/bake_iframes/main.rb
|
289
|
+
- lib/kitchen/directions/bake_iframes/v1.rb
|
283
290
|
- lib/kitchen/directions/bake_index/main.rb
|
284
291
|
- lib/kitchen/directions/bake_index/v1.rb
|
285
292
|
- lib/kitchen/directions/bake_index/v1.xhtml.erb
|
293
|
+
- lib/kitchen/directions/bake_injected_exercise.rb
|
294
|
+
- lib/kitchen/directions/bake_injected_exercise_question.rb
|
286
295
|
- lib/kitchen/directions/bake_inline_lists.rb
|
287
296
|
- lib/kitchen/directions/bake_link_placeholders.rb
|
288
297
|
- lib/kitchen/directions/bake_lists_with_para.rb
|
289
298
|
- lib/kitchen/directions/bake_math_in_paragraph.rb
|
290
299
|
- lib/kitchen/directions/bake_non_introduction_pages.rb
|
291
300
|
- lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
|
292
|
-
- lib/kitchen/directions/bake_notes/bake_note_iframes.rb
|
293
301
|
- lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
|
294
302
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb
|
295
303
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb
|
@@ -358,6 +366,8 @@ files:
|
|
358
366
|
- lib/kitchen/figure_element_enumerator.rb
|
359
367
|
- lib/kitchen/i18n_string.rb
|
360
368
|
- lib/kitchen/id_tracker.rb
|
369
|
+
- lib/kitchen/injected_question_element.rb
|
370
|
+
- lib/kitchen/injected_question_element_enumerator.rb
|
361
371
|
- lib/kitchen/metadata_element.rb
|
362
372
|
- lib/kitchen/metadata_element_enumerator.rb
|
363
373
|
- lib/kitchen/mixins/block_error_if.rb
|
@@ -382,6 +392,7 @@ files:
|
|
382
392
|
- lib/kitchen/selector.rb
|
383
393
|
- lib/kitchen/selectors/base.rb
|
384
394
|
- lib/kitchen/selectors/standard_1.rb
|
395
|
+
- lib/kitchen/solution_element_enumerator.rb
|
385
396
|
- lib/kitchen/table_element.rb
|
386
397
|
- lib/kitchen/table_element_enumerator.rb
|
387
398
|
- lib/kitchen/templates/eob_section_title_template.xhtml.erb
|
@@ -447,7 +458,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
447
458
|
- !ruby/object:Gem::Version
|
448
459
|
version: '0'
|
449
460
|
requirements: []
|
450
|
-
rubygems_version: 3.0.3
|
461
|
+
rubygems_version: 3.0.3.1
|
451
462
|
signing_key:
|
452
463
|
specification_version: 4
|
453
464
|
summary: OpenStax content baking library
|
File without changes
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen
|
4
|
-
module Directions
|
5
|
-
module BakeChapterIntroductions
|
6
|
-
def self.v1(book:, bake_chapter_objectives: true)
|
7
|
-
book.chapters.each do |chapter|
|
8
|
-
chapter_outline_html = ''
|
9
|
-
|
10
|
-
if bake_chapter_objectives
|
11
|
-
outline_items_html = chapter.non_introduction_pages.map do |page|
|
12
|
-
|
13
|
-
<<~HTML
|
14
|
-
<div class="os-chapter-objective">
|
15
|
-
<a class="os-chapter-objective" href="##{page.title[:id]}">
|
16
|
-
<span class="os-number">#{chapter.count_in(:book)}.#{page.count_in(:chapter)}</span>
|
17
|
-
<span class="os-divider"> </span>
|
18
|
-
<span data-type="" itemprop="" class="os-text">#{page.title.children[0].text}</span>
|
19
|
-
</a>
|
20
|
-
</div>
|
21
|
-
HTML
|
22
|
-
end.join('')
|
23
|
-
|
24
|
-
chapter_outline_html = <<~HTML
|
25
|
-
<div class="os-chapter-outline">
|
26
|
-
<h3 class="os-title">#{I18n.t(:chapter_outline)}</h3>
|
27
|
-
#{outline_items_html}
|
28
|
-
</div>
|
29
|
-
HTML
|
30
|
-
end
|
31
|
-
|
32
|
-
introduction_page = chapter.introduction_page
|
33
|
-
|
34
|
-
introduction_page.search("div[data-type='description']").trash
|
35
|
-
introduction_page.search("div[data-type='abstract']").trash
|
36
|
-
|
37
|
-
title = introduction_page.title.cut
|
38
|
-
title.name = 'h2'
|
39
|
-
MoveTitleTextIntoSpan.v1(title: title)
|
40
|
-
|
41
|
-
intro_content = introduction_page.search("> :not([data-type='metadata']):not(.splash):not(.has-splash)").cut
|
42
|
-
|
43
|
-
introduction_page.append(child:
|
44
|
-
<<~HTML
|
45
|
-
<div class="intro-body">
|
46
|
-
#{chapter_outline_html}
|
47
|
-
<div class="intro-text">
|
48
|
-
#{title.paste}
|
49
|
-
#{intro_content.paste}
|
50
|
-
</div>
|
51
|
-
</div>
|
52
|
-
HTML
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
v1_update_selectors(book)
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.v1_update_selectors(something_with_selectors)
|
60
|
-
something_with_selectors.selectors.title_in_introduction_page =
|
61
|
-
".intro-text > [data-type='document-title']"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,27 +0,0 @@
|
|
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
|