openstax_kitchen 12.2.0 → 16.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 +45 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -4
- data/codecov.yaml +4 -0
- data/lib/kitchen/directions/bake_all_chapter_solutions_types.rb +30 -0
- data/lib/kitchen/directions/bake_all_numbered_exercise_types.rb +26 -0
- data/lib/kitchen/directions/bake_annotation_classes/main.rb +2 -2
- data/lib/kitchen/directions/bake_annotation_classes/v1.rb +3 -3
- data/lib/kitchen/directions/bake_appendix.rb +1 -0
- data/lib/kitchen/directions/bake_autotitled_exercise/main.rb +8 -0
- data/lib/kitchen/directions/bake_autotitled_exercise/v2.rb +33 -0
- data/lib/kitchen/directions/bake_autotitled_exercise/v3.rb +35 -0
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +3 -1
- data/lib/kitchen/directions/bake_chapter_references/v1.rb +1 -1
- data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +1 -1
- data/lib/kitchen/directions/bake_chapter_summary.rb +1 -1
- data/lib/kitchen/directions/bake_example.rb +1 -1
- data/lib/kitchen/directions/bake_figure.rb +1 -15
- data/lib/kitchen/directions/bake_footnotes/v1.rb +1 -1
- data/lib/kitchen/directions/bake_iframes/v1.rb +2 -0
- data/lib/kitchen/directions/bake_index/v1.rb +1 -1
- data/lib/kitchen/directions/bake_index/v1.xhtml.erb +5 -9
- data/lib/kitchen/directions/{bake_injected_exercise.rb → bake_injected_exercise/bake_injected_exercise.rb} +10 -1
- data/lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise_question.rb +4 -0
- data/lib/kitchen/directions/bake_learning_objectives.rb +13 -0
- data/lib/kitchen/directions/bake_lo_link_labels.rb +19 -0
- data/lib/kitchen/directions/bake_non_introduction_pages.rb +3 -1
- data/lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb +1 -26
- data/lib/kitchen/directions/bake_notes/bake_note_exercise.rb +54 -0
- data/lib/kitchen/directions/bake_notes/bake_note_injected_question.rb +15 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +0 -31
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +2 -2
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +2 -2
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +2 -2
- data/lib/kitchen/directions/bake_notes/bake_unclassified_notes.rb +5 -3
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +8 -3
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +48 -7
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +3 -0
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +2 -1
- data/lib/kitchen/directions/bake_references/main.rb +6 -9
- data/lib/kitchen/directions/bake_references/v1.rb +22 -8
- data/lib/kitchen/directions/bake_references/v2.rb +9 -10
- data/lib/kitchen/directions/bake_references/v3.rb +32 -0
- data/lib/kitchen/directions/bake_screenreader_spans.rb +22 -0
- data/lib/kitchen/directions/bake_unnumbered_exercise.rb +16 -0
- data/lib/kitchen/directions/bake_unnumbered_figure.rb +26 -0
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_container.xhtml.erb +9 -0
- data/lib/kitchen/directions/book_answer_key_container/v1.rb +6 -2
- data/lib/kitchen/directions/{eoc_composite_page_container → composite_page_container}/main.rb +1 -1
- data/lib/kitchen/directions/composite_page_container/v1.rb +28 -0
- data/lib/kitchen/directions/default_strategy_for_answer_key_solutions.rb +35 -0
- data/lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb +29 -0
- data/lib/kitchen/element_base.rb +8 -4
- data/lib/kitchen/element_enumerator_base.rb +36 -0
- data/lib/kitchen/figure_element.rb +12 -4
- data/lib/kitchen/injected_exercise_element.rb +41 -0
- data/lib/kitchen/injected_exercise_element_enumerator.rb +21 -0
- data/lib/kitchen/injected_question_element.rb +7 -0
- data/lib/kitchen/patches/i18n.rb +4 -0
- data/lib/kitchen/patches/nokogiri.rb +8 -0
- data/lib/kitchen/patches/renderable.rb +1 -1
- data/lib/kitchen/section_element.rb +27 -0
- data/lib/kitchen/section_element_enumerator.rb +20 -0
- data/lib/kitchen/selectors/base.rb +6 -0
- data/lib/kitchen/selectors/standard_1.rb +2 -0
- data/lib/kitchen/templates/composite_page_template.xhtml.erb +10 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +4 -0
- data/lib/locales/es.yml +9 -1
- data/lib/locales/pl.yml +3 -0
- metadata +24 -14
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +0 -9
- data/lib/kitchen/directions/eoc_composite_page_container/v1.rb +0 -19
- data/lib/kitchen/directions/move_solutions_to_answer_key/main.rb +0 -18
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb +0 -41
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb +0 -40
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +0 -27
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +0 -63
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb +0 -21
- data/lib/kitchen/directions/move_solutions_to_answer_key/v1.rb +0 -47
- data/lib/kitchen/templates/eoc_section_template.xhtml.erb +0 -11
@@ -318,6 +318,42 @@ module Kitchen
|
|
318
318
|
css_or_xpath: css_or_xpath, only: only, except: except)
|
319
319
|
end
|
320
320
|
|
321
|
+
# Returns an enumerator that iterates through sections within the scope of this enumerator
|
322
|
+
#
|
323
|
+
# @param css_or_xpath [String] additional selectors to further narrow the element iterated over;
|
324
|
+
# a "$" in this argument will be replaced with the default selector for the element being
|
325
|
+
# iterated over.
|
326
|
+
# @param only [Symbol, Callable] the name of a method to call on an element or a
|
327
|
+
# lambda or proc that accepts an element; elements will only be included in the
|
328
|
+
# search results if the method or callable returns true
|
329
|
+
# @param except [Symbol, Callable] the name of a method to call on an element or a
|
330
|
+
# lambda or proc that accepts an element; elements will not be included in the
|
331
|
+
# search results if the method or callable returns false
|
332
|
+
#
|
333
|
+
def sections(css_or_xpath=nil, only: nil, except: nil)
|
334
|
+
block_error_if(block_given?)
|
335
|
+
chain_to(SectionElementEnumerator,
|
336
|
+
css_or_xpath: css_or_xpath, only: only, except: except)
|
337
|
+
end
|
338
|
+
|
339
|
+
# Returns an enumerator that iterates through injected exercises within the scope of this enumerator
|
340
|
+
#
|
341
|
+
# @param css_or_xpath [String] additional selectors to further narrow the element iterated over;
|
342
|
+
# a "$" in this argument will be replaced with the default selector for the element being
|
343
|
+
# iterated over.
|
344
|
+
# @param only [Symbol, Callable] the name of a method to call on an element or a
|
345
|
+
# lambda or proc that accepts an element; elements will only be included in the
|
346
|
+
# search results if the method or callable returns true
|
347
|
+
# @param except [Symbol, Callable] the name of a method to call on an element or a
|
348
|
+
# lambda or proc that accepts an element; elements will not be included in the
|
349
|
+
# search results if the method or callable returns false
|
350
|
+
#
|
351
|
+
def injected_exercises(css_or_xpath=nil, only: nil, except: nil)
|
352
|
+
block_error_if(block_given?)
|
353
|
+
chain_to(InjectedExerciseElementEnumerator,
|
354
|
+
css_or_xpath: css_or_xpath, only: only, except: except)
|
355
|
+
end
|
356
|
+
|
321
357
|
# Returns an enumerator that iterates within the scope of this enumerator
|
322
358
|
#
|
323
359
|
# @param css_or_xpath [String] additional selectors to further narrow the element iterated over
|
@@ -47,16 +47,24 @@ module Kitchen
|
|
47
47
|
parent.name == 'figure'
|
48
48
|
end
|
49
49
|
|
50
|
+
# Returns true if the figure is unnumbered
|
51
|
+
#
|
52
|
+
# @return [Boolean]
|
53
|
+
#
|
54
|
+
|
55
|
+
def unnumbered?
|
56
|
+
has_class?('unnumbered')
|
57
|
+
end
|
58
|
+
|
50
59
|
# Returns true unless the figure is a subfigure or has the 'unnumbered' class,
|
51
60
|
# unless the figure has both the 'unnumbered' and the 'splash' classes.
|
52
61
|
#
|
53
62
|
# @return [Boolean]
|
54
|
-
|
55
|
-
def
|
56
|
-
return false if subfigure? ||
|
63
|
+
|
64
|
+
def figure_to_number?
|
65
|
+
return false if subfigure? || unnumbered?
|
57
66
|
|
58
67
|
true
|
59
68
|
end
|
60
|
-
|
61
69
|
end
|
62
70
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An element for an example
|
5
|
+
#
|
6
|
+
class InjectedExerciseElement < ElementBase
|
7
|
+
|
8
|
+
# Creates a new +InjectedQuestionElement+
|
9
|
+
#
|
10
|
+
# @param node [Nokogiri::XML::Node] the node this element wraps
|
11
|
+
# @param document [Document] this element's document
|
12
|
+
#
|
13
|
+
def initialize(node:, document: nil)
|
14
|
+
super(node: node,
|
15
|
+
document: document,
|
16
|
+
enumerator_class: InjectedExerciseElementEnumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns the short type
|
20
|
+
# @return [Symbol]
|
21
|
+
#
|
22
|
+
def self.short_type
|
23
|
+
:injected_exercise
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns the exercise context element.
|
27
|
+
# @return [Element]
|
28
|
+
#
|
29
|
+
def exercise_context
|
30
|
+
first("div[data-type='exercise-context']")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the exercise question element.
|
34
|
+
# @return [Element]
|
35
|
+
#
|
36
|
+
def exercise_question
|
37
|
+
first("div[data-type='exercise-question']")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An enumerator for example elements
|
5
|
+
#
|
6
|
+
class InjectedExerciseElementEnumerator < 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_exercise),
|
15
|
+
sub_element_class: InjectedExerciseElement,
|
16
|
+
enumerator_class: self
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -55,6 +55,13 @@ module Kitchen
|
|
55
55
|
first("div[data-type='question-solution']")
|
56
56
|
end
|
57
57
|
|
58
|
+
# Returns the exercise context element.
|
59
|
+
# @return [Element]
|
60
|
+
#
|
61
|
+
def exercise_context_in_question
|
62
|
+
first("div[data-type='exercise-context']")
|
63
|
+
end
|
64
|
+
|
58
65
|
# Returns the answer correctness given an alphabet
|
59
66
|
#
|
60
67
|
# @return [Array]
|
data/lib/kitchen/patches/i18n.rb
CHANGED
@@ -4,6 +4,10 @@ require 'twitter_cldr'
|
|
4
4
|
|
5
5
|
# rubocop:disable Style/Documentation
|
6
6
|
module I18n
|
7
|
+
def self.character_to_group(character)
|
8
|
+
I18n.locale == :pl ? character : I18n.transliterate(character)
|
9
|
+
end
|
10
|
+
|
7
11
|
def self.sort_strings(first, second)
|
8
12
|
string_sorter.compare(first, second)
|
9
13
|
end
|
@@ -74,6 +74,14 @@ module Nokogiri
|
|
74
74
|
prev.text? ? prev.previous : prev
|
75
75
|
end
|
76
76
|
|
77
|
+
def preceded_by_text?
|
78
|
+
prev = previous_sibling
|
79
|
+
while !prev.nil? && prev.blank? do prev = prev.previous_sibling end
|
80
|
+
return false if prev.nil?
|
81
|
+
|
82
|
+
prev.text?
|
83
|
+
end
|
84
|
+
|
77
85
|
def self.selector_to_css_nodes(selector)
|
78
86
|
# No need to parse the same selector more than once.
|
79
87
|
@parsed_selectors ||= {}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An element for an example
|
5
|
+
#
|
6
|
+
class SectionElement < ElementBase
|
7
|
+
|
8
|
+
# Creates a new +SectionElement+
|
9
|
+
#
|
10
|
+
# @param node [Nokogiri::XML::Node] the node this element wraps
|
11
|
+
# @param document [Document] this element's document
|
12
|
+
#
|
13
|
+
def initialize(node:, document: nil)
|
14
|
+
super(node: node,
|
15
|
+
document: document,
|
16
|
+
enumerator_class: SectionElementEnumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns the short type
|
20
|
+
# @return [Symbol]
|
21
|
+
#
|
22
|
+
def self.short_type
|
23
|
+
:section
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kitchen
|
4
|
+
# An enumerator for table elements
|
5
|
+
#
|
6
|
+
class SectionElementEnumerator < ElementEnumeratorBase
|
7
|
+
# Returns a factory for this enumerator
|
8
|
+
#
|
9
|
+
# @return [ElementEnumeratorFactory]
|
10
|
+
#
|
11
|
+
def self.factory
|
12
|
+
ElementEnumeratorFactory.new(
|
13
|
+
default_css_or_xpath: Selector.named(:section),
|
14
|
+
sub_element_class: SectionElement,
|
15
|
+
enumerator_class: self
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -62,6 +62,12 @@ module Kitchen
|
|
62
62
|
# Selector for an injected question
|
63
63
|
# @return [String]
|
64
64
|
attr_accessor :injected_question
|
65
|
+
# Selector for a section
|
66
|
+
# @return [String]
|
67
|
+
attr_accessor :section
|
68
|
+
# Selector for an injected exercise
|
69
|
+
# @return [String]
|
70
|
+
attr_accessor :injected_exercise
|
65
71
|
|
66
72
|
# Override specific selectors
|
67
73
|
#
|
@@ -29,6 +29,8 @@ module Kitchen
|
|
29
29
|
self.solution = "div[data-type='solution'], " \
|
30
30
|
"div[data-type='question-solution']"
|
31
31
|
self.injected_question = "div[data-type='exercise-question']"
|
32
|
+
self.section = 'section'
|
33
|
+
self.injected_exercise = "div[data-type='injected-exercise']"
|
32
34
|
end
|
33
35
|
|
34
36
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="os-<%= @section%> os-<%=@container_class_type%>-container" data-type="composite-page" data-uuid-key="<%= @uuid_key %>">
|
2
|
+
<<%= @main_title_tag %> data-type="<%= @in_composite_chapter ? 'title' : 'document-title' %>">
|
3
|
+
<span class="os-text"><%= @title %></span>
|
4
|
+
</<%= @main_title_tag %>>
|
5
|
+
<div data-type="metadata" style="display: none;">
|
6
|
+
<h1 data-type="document-title" itemprop="name"><%= @title %></h1>
|
7
|
+
<%= @metadata.paste %>
|
8
|
+
</div>
|
9
|
+
<%= @content %>
|
10
|
+
</div>
|
data/lib/kitchen/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -28,6 +28,7 @@ en:
|
|
28
28
|
iframe_link_text: Click to view content
|
29
29
|
handbook_outline_title: Outline
|
30
30
|
context_lead_text: 'Refer to '
|
31
|
+
lo_label_text: 'LO '
|
31
32
|
eoc:
|
32
33
|
glossary: Key Terms
|
33
34
|
key-equations: Key Equations
|
@@ -40,5 +41,8 @@ en:
|
|
40
41
|
folio:
|
41
42
|
preface: Preface
|
42
43
|
access_for_free: Access for free at openstax.org
|
44
|
+
eob:
|
45
|
+
references: References
|
46
|
+
reference: References
|
43
47
|
index:
|
44
48
|
main: Index
|
data/lib/locales/es.yml
CHANGED
@@ -21,19 +21,27 @@ es:
|
|
21
21
|
eoc_exercises_title: Ejercicios
|
22
22
|
eoc_composite_metadata_title: Revisión Del Capítulo
|
23
23
|
eoc_solutions_title: Soluciones
|
24
|
-
eoc_key_concepts: Conceptos Clave
|
25
24
|
eoc_suggested_reading: Sugerencias Para Estudios Adicionales
|
26
25
|
eob_index_symbols_group: Símbolos
|
27
26
|
review_exercises: Ejercicios De Repaso
|
28
27
|
section_exercises: ! 'Sección %{number} Ejercicios'
|
28
|
+
iframe_link_text: Haga Clic Para Ver El Contenido
|
29
|
+
handbook_outline_title: Esquema
|
30
|
+
context_lead_text: 'Referirse a '
|
29
31
|
eoc:
|
30
32
|
glossary: Términos Clave
|
31
33
|
key-equations: Ecuaciones Clave
|
32
34
|
summary: Resumen
|
33
35
|
further-research: Investigación Adicional
|
36
|
+
key-concepts: Conceptos Clave
|
34
37
|
references: Referencias
|
38
|
+
solutions: Soluciones
|
39
|
+
section-exercises: ! 'Sección %{number} Ejercicios'
|
35
40
|
folio:
|
36
41
|
preface: Prefacio
|
37
42
|
access_for_free: Acceso gratis en openstax.org
|
43
|
+
eob:
|
44
|
+
references: Referencias
|
45
|
+
reference: Referencias
|
38
46
|
index:
|
39
47
|
main: Índice
|
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:
|
4
|
+
version: 16.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-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -244,11 +244,15 @@ files:
|
|
244
244
|
- lib/kitchen/debug/print_recipe_error.rb
|
245
245
|
- lib/kitchen/directions/.rubocop.yml
|
246
246
|
- lib/kitchen/directions/bake_accessibility_fixes.rb
|
247
|
+
- lib/kitchen/directions/bake_all_chapter_solutions_types.rb
|
248
|
+
- lib/kitchen/directions/bake_all_numbered_exercise_types.rb
|
247
249
|
- lib/kitchen/directions/bake_annotation_classes/main.rb
|
248
250
|
- lib/kitchen/directions/bake_annotation_classes/v1.rb
|
249
251
|
- lib/kitchen/directions/bake_appendix.rb
|
250
252
|
- lib/kitchen/directions/bake_autotitled_exercise/main.rb
|
251
253
|
- lib/kitchen/directions/bake_autotitled_exercise/v1.rb
|
254
|
+
- lib/kitchen/directions/bake_autotitled_exercise/v2.rb
|
255
|
+
- lib/kitchen/directions/bake_autotitled_exercise/v3.rb
|
252
256
|
- lib/kitchen/directions/bake_chapter_glossary/main.rb
|
253
257
|
- lib/kitchen/directions/bake_chapter_glossary/v1.rb
|
254
258
|
- lib/kitchen/directions/bake_chapter_introductions/bake_chapter_objectives.rb
|
@@ -293,16 +297,19 @@ files:
|
|
293
297
|
- lib/kitchen/directions/bake_index/main.rb
|
294
298
|
- lib/kitchen/directions/bake_index/v1.rb
|
295
299
|
- lib/kitchen/directions/bake_index/v1.xhtml.erb
|
296
|
-
- lib/kitchen/directions/bake_injected_exercise.rb
|
297
300
|
- lib/kitchen/directions/bake_injected_exercise/add_injected_exercise_id.rb
|
301
|
+
- lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise.rb
|
298
302
|
- lib/kitchen/directions/bake_injected_exercise/bake_injected_exercise_question.rb
|
299
303
|
- lib/kitchen/directions/bake_inline_lists.rb
|
300
304
|
- lib/kitchen/directions/bake_learning_objectives.rb
|
301
305
|
- lib/kitchen/directions/bake_link_placeholders.rb
|
302
306
|
- lib/kitchen/directions/bake_lists_with_para.rb
|
307
|
+
- lib/kitchen/directions/bake_lo_link_labels.rb
|
303
308
|
- lib/kitchen/directions/bake_math_in_paragraph.rb
|
304
309
|
- lib/kitchen/directions/bake_non_introduction_pages.rb
|
305
310
|
- lib/kitchen/directions/bake_notes/bake_autotitled_notes.rb
|
311
|
+
- lib/kitchen/directions/bake_notes/bake_note_exercise.rb
|
312
|
+
- lib/kitchen/directions/bake_notes/bake_note_injected_question.rb
|
306
313
|
- lib/kitchen/directions/bake_notes/bake_note_subtitle.rb
|
307
314
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb
|
308
315
|
- lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb
|
@@ -320,6 +327,8 @@ files:
|
|
320
327
|
- lib/kitchen/directions/bake_references/main.rb
|
321
328
|
- lib/kitchen/directions/bake_references/v1.rb
|
322
329
|
- lib/kitchen/directions/bake_references/v2.rb
|
330
|
+
- lib/kitchen/directions/bake_references/v3.rb
|
331
|
+
- lib/kitchen/directions/bake_screenreader_spans.rb
|
323
332
|
- lib/kitchen/directions/bake_stepwise.rb
|
324
333
|
- lib/kitchen/directions/bake_suggested_reading.rb
|
325
334
|
- lib/kitchen/directions/bake_toc.rb
|
@@ -327,15 +336,18 @@ files:
|
|
327
336
|
- lib/kitchen/directions/bake_unit_page_title/v1.rb
|
328
337
|
- lib/kitchen/directions/bake_unit_title/main.rb
|
329
338
|
- lib/kitchen/directions/bake_unit_title/v1.rb
|
339
|
+
- lib/kitchen/directions/bake_unnumbered_exercise.rb
|
340
|
+
- lib/kitchen/directions/bake_unnumbered_figure.rb
|
330
341
|
- lib/kitchen/directions/bake_unnumbered_tables.rb
|
331
|
-
- lib/kitchen/directions/book_answer_key_container/
|
342
|
+
- lib/kitchen/directions/book_answer_key_container/eob_answer_key_container.xhtml.erb
|
332
343
|
- lib/kitchen/directions/book_answer_key_container/main.rb
|
333
344
|
- lib/kitchen/directions/book_answer_key_container/v1.rb
|
334
345
|
- lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb
|
335
346
|
- lib/kitchen/directions/chapter_review_container/main.rb
|
336
347
|
- lib/kitchen/directions/chapter_review_container/v1.rb
|
337
|
-
- lib/kitchen/directions/
|
338
|
-
- lib/kitchen/directions/
|
348
|
+
- lib/kitchen/directions/composite_page_container/main.rb
|
349
|
+
- lib/kitchen/directions/composite_page_container/v1.rb
|
350
|
+
- lib/kitchen/directions/default_strategy_for_answer_key_solutions.rb
|
339
351
|
- lib/kitchen/directions/eoc_section_title_link_snippet.rb
|
340
352
|
- lib/kitchen/directions/move_custom_section_to_eoc_container/main.rb
|
341
353
|
- lib/kitchen/directions/move_custom_section_to_eoc_container/v1.rb
|
@@ -343,16 +355,10 @@ files:
|
|
343
355
|
- lib/kitchen/directions/move_exercises_to_eoc/v1.rb
|
344
356
|
- lib/kitchen/directions/move_exercises_to_eoc/v2.rb
|
345
357
|
- lib/kitchen/directions/move_exercises_to_eoc/v3.rb
|
346
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/
|
358
|
+
- lib/kitchen/directions/move_solutions_to_answer_key/answer_key_inner_container.rb
|
347
359
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_exercise_section.rb
|
348
360
|
- lib/kitchen/directions/move_solutions_to_answer_key/move_solutions_from_numbered_note.rb
|
349
361
|
- lib/kitchen/directions/move_solutions_to_answer_key/solution_area_snippet.rb
|
350
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/calculus.rb
|
351
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/contemporary_math.rb
|
352
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb
|
353
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb
|
354
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/strategies/uphysics.rb
|
355
|
-
- lib/kitchen/directions/move_solutions_to_answer_key/v1.rb
|
356
362
|
- lib/kitchen/directions/move_title_text_into_span.rb
|
357
363
|
- lib/kitchen/document.rb
|
358
364
|
- lib/kitchen/element.rb
|
@@ -370,6 +376,8 @@ files:
|
|
370
376
|
- lib/kitchen/figure_element_enumerator.rb
|
371
377
|
- lib/kitchen/i18n_string.rb
|
372
378
|
- lib/kitchen/id_tracker.rb
|
379
|
+
- lib/kitchen/injected_exercise_element.rb
|
380
|
+
- lib/kitchen/injected_exercise_element_enumerator.rb
|
373
381
|
- lib/kitchen/injected_question_element.rb
|
374
382
|
- lib/kitchen/injected_question_element_enumerator.rb
|
375
383
|
- lib/kitchen/metadata_element.rb
|
@@ -393,14 +401,16 @@ files:
|
|
393
401
|
- lib/kitchen/references_element_enumerator.rb
|
394
402
|
- lib/kitchen/search_history.rb
|
395
403
|
- lib/kitchen/search_query.rb
|
404
|
+
- lib/kitchen/section_element.rb
|
405
|
+
- lib/kitchen/section_element_enumerator.rb
|
396
406
|
- lib/kitchen/selector.rb
|
397
407
|
- lib/kitchen/selectors/base.rb
|
398
408
|
- lib/kitchen/selectors/standard_1.rb
|
399
409
|
- lib/kitchen/solution_element_enumerator.rb
|
400
410
|
- lib/kitchen/table_element.rb
|
401
411
|
- lib/kitchen/table_element_enumerator.rb
|
412
|
+
- lib/kitchen/templates/composite_page_template.xhtml.erb
|
402
413
|
- lib/kitchen/templates/eob_section_title_template.xhtml.erb
|
403
|
-
- lib/kitchen/templates/eoc_section_template.xhtml.erb
|
404
414
|
- lib/kitchen/templates/eoc_section_template_old.xhtml.erb
|
405
415
|
- lib/kitchen/term_element.rb
|
406
416
|
- lib/kitchen/term_element_enumerator.rb
|
data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<div class="os-eob os-<%= @solutions_or_solution %>-container" data-type="composite-chapter" data-uuid-key=".<%= @solutions_or_solution %>">
|
2
|
-
<h1 data-type="document-title">
|
3
|
-
<span class="os-text"><%= I18n.t(:answer_key_title) %></span>
|
4
|
-
</h1>
|
5
|
-
<div data-type="metadata" style="display: none;">
|
6
|
-
<h1 data-type="document-title" itemprop="name"><%= I18n.t(:answer_key_title) %></h1>
|
7
|
-
<%= @metadata.paste %>
|
8
|
-
</div>
|
9
|
-
</div>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen::Directions::EocCompositePageContainer
|
4
|
-
class V1
|
5
|
-
renderable
|
6
|
-
|
7
|
-
def bake(container_key:, uuid_key:, metadata_source:, content:, append_to:)
|
8
|
-
@title = I18n.t(:"eoc.#{container_key}")
|
9
|
-
@uuid_key = uuid_key
|
10
|
-
@container_class_type = container_key
|
11
|
-
@metadata = metadata_source.children_to_keep.copy
|
12
|
-
@content = content
|
13
|
-
@in_composite_chapter = append_to.is?(:composite_chapter)
|
14
|
-
|
15
|
-
append_to.append(child: render(file:
|
16
|
-
'../../templates/eoc_section_template.xhtml.erb'))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen
|
4
|
-
module Directions
|
5
|
-
module MoveSolutionsToAnswerKey
|
6
|
-
def self.v1(chapter:, metadata_source:, strategy:, append_to:, strategy_options: {}, solutions_plural: true)
|
7
|
-
V1.new.bake(
|
8
|
-
chapter: chapter,
|
9
|
-
metadata_source: metadata_source,
|
10
|
-
strategy: strategy,
|
11
|
-
append_to: append_to,
|
12
|
-
strategy_options: strategy_options,
|
13
|
-
solutions_plural: solutions_plural
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
|
-
module Strategies
|
5
|
-
class Calculus
|
6
|
-
def bake(chapter:, append_to:)
|
7
|
-
checkpoint_solutions = chapter.search('div.checkpoint div[data-type="solution"]').cut
|
8
|
-
append_solution_area(I18n.t(:checkpoint), checkpoint_solutions, append_to)
|
9
|
-
|
10
|
-
chapter.search('section.section-exercises').each do |section|
|
11
|
-
section_solutions = section.search('div[data-type="solution"]').cut
|
12
|
-
section_title = I18n.t(
|
13
|
-
:section_exercises,
|
14
|
-
number: "#{chapter.count_in(:book)}.#{section.count_in(:chapter)}"
|
15
|
-
)
|
16
|
-
append_solution_area(section_title, section_solutions, append_to)
|
17
|
-
end
|
18
|
-
|
19
|
-
chapter.search('section.review-exercises').each do |section|
|
20
|
-
section_solutions = section.search('div[data-type="solution"]').cut
|
21
|
-
append_solution_area(I18n.t(:review_exercises), section_solutions, append_to)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
protected
|
26
|
-
|
27
|
-
def append_solution_area(title, clipboard, append_to)
|
28
|
-
append_to.append(child:
|
29
|
-
<<~HTML
|
30
|
-
<div class="os-solution-area">
|
31
|
-
<h3 data-type="title">
|
32
|
-
<span class="os-title-label">#{title}</span>
|
33
|
-
</h3>
|
34
|
-
#{clipboard.paste}
|
35
|
-
</div>
|
36
|
-
HTML
|
37
|
-
)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
|
-
module Strategies
|
5
|
-
class ContemporaryMath
|
6
|
-
def bake(chapter:, append_to:)
|
7
|
-
# Hacky numbering fix
|
8
|
-
chapter.notes('$.your-turn').exercises.each do |exercise|
|
9
|
-
solution = exercise.solution
|
10
|
-
next unless solution
|
11
|
-
|
12
|
-
number = exercise.ancestor(:note).count_in(:chapter)
|
13
|
-
solution.first('a.os-number').inner_html = number.to_s
|
14
|
-
solution.first('span.os-divider').inner_html = '. '
|
15
|
-
end
|
16
|
-
|
17
|
-
Kitchen::Directions::MoveSolutionsFromNumberedNote.v1(
|
18
|
-
chapter: chapter, append_to: append_to, note_class: 'your-turn'
|
19
|
-
)
|
20
|
-
|
21
|
-
# Bake section exercises
|
22
|
-
chapter.non_introduction_pages.each do |page|
|
23
|
-
number = "#{chapter.count_in(:book)}.#{page.count_in(:chapter)}"
|
24
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
25
|
-
chapter: page, append_to: append_to, section_class: 'section-exercises',
|
26
|
-
title_number: number
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Bake other exercise sections
|
31
|
-
classes = %w[chapter-review chapter-test]
|
32
|
-
classes.each do |klass|
|
33
|
-
Kitchen::Directions::MoveSolutionsFromExerciseSection.v1(
|
34
|
-
chapter: chapter, append_to: append_to, section_class: klass
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Kitchen::Directions::MoveSolutionsToAnswerKey
|
4
|
-
module Strategies
|
5
|
-
class Default
|
6
|
-
def bake(chapter:, append_to:)
|
7
|
-
bake_section(chapter: chapter, append_to: append_to)
|
8
|
-
end
|
9
|
-
|
10
|
-
protected
|
11
|
-
|
12
|
-
def bake_section(chapter:, append_to:)
|
13
|
-
@selectors.each do |selector|
|
14
|
-
chapter.search("#{selector} div[data-type='solution']").each do |solution|
|
15
|
-
append_to.append(child: solution.cut.to_s)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# This method helps to obtain more strategy-specific params through
|
21
|
-
# "strategy_options: {blah1: 1, blah2: 2}"
|
22
|
-
def initialize(strategy_options)
|
23
|
-
@selectors = strategy_options[:selectors] || (raise 'missing selectors for strategy')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|