openstax_kitchen 3.2.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/changelog.yml +27 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/.gitignore +1 -1
- data/CHANGELOG.md +94 -1
- data/Gemfile.lock +26 -18
- data/README.md +16 -0
- data/codecov.yaml +1 -0
- data/docker/ci +0 -1
- data/docker/rubocop +22 -0
- data/lib/kitchen/book_document.rb +1 -1
- data/lib/kitchen/book_element.rb +16 -2
- data/lib/kitchen/chapter_element.rb +10 -13
- data/lib/kitchen/chapter_element_enumerator.rb +1 -1
- data/lib/kitchen/composite_chapter_element.rb +7 -11
- data/lib/kitchen/composite_chapter_element_enumerator.rb +21 -0
- data/lib/kitchen/composite_page_element.rb +15 -10
- data/lib/kitchen/composite_page_element_enumerator.rb +1 -1
- data/lib/kitchen/config.rb +14 -0
- data/lib/kitchen/directions/bake_appendix.rb +3 -1
- data/lib/kitchen/directions/bake_chapter_glossary/main.rb +18 -0
- data/lib/kitchen/directions/bake_chapter_glossary/v1.rb +30 -0
- data/lib/kitchen/directions/bake_chapter_introductions.rb +23 -16
- data/lib/kitchen/directions/bake_chapter_introductions/chapter_introduction.xhtml.erb +0 -0
- data/lib/kitchen/directions/bake_chapter_key_concepts/main.rb +7 -2
- data/lib/kitchen/directions/bake_chapter_key_concepts/v1.rb +12 -7
- data/lib/kitchen/directions/bake_chapter_key_equations.rb +26 -21
- data/lib/kitchen/directions/bake_chapter_references/main.rb +16 -0
- data/lib/kitchen/directions/bake_chapter_references/v1.rb +35 -0
- data/lib/kitchen/directions/bake_chapter_section_exercises/main.rb +2 -2
- data/lib/kitchen/directions/bake_chapter_section_exercises/v1.rb +2 -1
- data/lib/kitchen/directions/bake_chapter_solutions/main.rb +11 -0
- data/lib/kitchen/directions/bake_chapter_solutions/v1.rb +37 -0
- data/lib/kitchen/directions/bake_chapter_summary.rb +56 -43
- data/lib/kitchen/directions/bake_composite_chapters.rb +1 -1
- data/lib/kitchen/directions/bake_composite_pages.rb +1 -1
- data/lib/kitchen/directions/bake_equations.rb +2 -2
- data/lib/kitchen/directions/bake_example.rb +8 -1
- data/lib/kitchen/directions/bake_figure.rb +14 -1
- data/lib/kitchen/directions/bake_first_elements.rb +22 -0
- data/lib/kitchen/directions/bake_footnotes/main.rb +2 -2
- data/lib/kitchen/directions/bake_footnotes/v1.rb +13 -9
- data/lib/kitchen/directions/bake_free_response/free_response.xhtml.erb +10 -0
- data/lib/kitchen/directions/{bake_chapter_review → bake_free_response}/main.rb +3 -3
- data/lib/kitchen/directions/bake_free_response/v1.rb +29 -0
- data/lib/kitchen/directions/bake_further_research.rb +61 -0
- data/lib/kitchen/directions/bake_index/v1.rb +36 -26
- data/lib/kitchen/directions/bake_link_placeholders.rb +1 -1
- data/lib/kitchen/directions/bake_notes/bake_note_subtitle.rb +4 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/main.rb +43 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v1.rb +37 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v2.rb +25 -0
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes/v3.rb +32 -0
- data/lib/kitchen/directions/bake_numbered_exercise/main.rb +7 -2
- data/lib/kitchen/directions/bake_numbered_exercise/v1.rb +34 -12
- data/lib/kitchen/directions/bake_numbered_table/bake_table_body.rb +29 -0
- data/lib/kitchen/directions/bake_numbered_table/main.rb +4 -0
- data/lib/kitchen/directions/bake_numbered_table/v1.rb +1 -24
- data/lib/kitchen/directions/bake_numbered_table/v2.rb +31 -0
- data/lib/kitchen/directions/bake_page_abstracts.rb +1 -1
- data/lib/kitchen/directions/bake_preface/main.rb +2 -2
- data/lib/kitchen/directions/bake_preface/v1.rb +3 -2
- data/lib/kitchen/directions/bake_references/main.rb +16 -0
- data/lib/kitchen/directions/bake_references/v1.rb +48 -0
- data/lib/kitchen/directions/bake_suggested_reading.rb +5 -0
- data/lib/kitchen/directions/bake_toc.rb +4 -2
- data/lib/kitchen/directions/book_answer_key_container/eob_answer_key_outer_container.xhtml.erb +9 -0
- data/lib/kitchen/directions/book_answer_key_container/main.rb +11 -0
- data/lib/kitchen/directions/book_answer_key_container/v1.rb +14 -0
- data/lib/kitchen/directions/chapter_review_container/chapter_review.xhtml.erb +9 -0
- data/lib/kitchen/directions/chapter_review_container/main.rb +11 -0
- data/lib/kitchen/directions/chapter_review_container/v1.rb +15 -0
- data/lib/kitchen/directions/eoc_section_title_link_snippet.rb +14 -1
- data/lib/kitchen/directions/move_exercises_to_eoc/main.rb +37 -0
- data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v1.rb +8 -10
- data/lib/kitchen/directions/{bake_chapter_review_exercises → move_exercises_to_eoc}/v2.rb +8 -9
- data/lib/kitchen/directions/move_exercises_to_eoc/v3.rb +49 -0
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/main.rb +7 -3
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/calculus.rb +1 -1
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/default.rb +27 -0
- data/lib/kitchen/directions/move_solutions_to_answer_key/strategies/precalculus.rb +84 -0
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/strategies/uphysics.rb +7 -5
- data/lib/kitchen/directions/{bake_chapter_answer_key → move_solutions_to_answer_key}/v1.rb +12 -6
- data/lib/kitchen/document.rb +20 -42
- data/lib/kitchen/element.rb +9 -3
- data/lib/kitchen/element_base.rb +108 -21
- data/lib/kitchen/element_enumerator_base.rb +33 -2
- data/lib/kitchen/element_enumerator_factory.rb +28 -12
- data/lib/kitchen/element_factory.rb +3 -3
- data/lib/kitchen/example_element.rb +8 -11
- data/lib/kitchen/example_element_enumerator.rb +1 -1
- data/lib/kitchen/exercise_element.rb +7 -10
- data/lib/kitchen/exercise_element_enumerator.rb +1 -1
- data/lib/kitchen/figure_element.rb +8 -11
- data/lib/kitchen/figure_element_enumerator.rb +1 -1
- data/lib/kitchen/id_tracker.rb +68 -0
- data/lib/kitchen/metadata_element.rb +8 -2
- data/lib/kitchen/metadata_element_enumerator.rb +1 -1
- data/lib/kitchen/note_element.rb +8 -11
- data/lib/kitchen/note_element_enumerator.rb +1 -1
- data/lib/kitchen/oven.rb +5 -1
- data/lib/kitchen/page_element.rb +27 -12
- data/lib/kitchen/page_element_enumerator.rb +1 -1
- data/lib/kitchen/patches/i18n.rb +34 -0
- data/lib/kitchen/patches/integer.rb +24 -0
- data/lib/kitchen/patches/nokogiri.rb +62 -0
- data/lib/kitchen/patches/nokogiri_profiling.rb +60 -0
- data/lib/kitchen/reference_element.rb +27 -0
- data/lib/kitchen/references_element_enumerator.rb +20 -0
- data/lib/kitchen/search_query.rb +31 -3
- data/lib/kitchen/selector.rb +25 -0
- data/lib/kitchen/selectors/base.rb +39 -0
- data/lib/kitchen/selectors/standard_1.rb +13 -0
- data/lib/kitchen/table_element.rb +8 -11
- data/lib/kitchen/table_element_enumerator.rb +1 -1
- data/lib/kitchen/templates/eob_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/templates/eoc_section_title_template.xhtml.erb +10 -0
- data/lib/kitchen/term_element.rb +5 -8
- data/lib/kitchen/term_element_enumerator.rb +1 -1
- data/lib/kitchen/unit_element.rb +13 -7
- data/lib/kitchen/unit_element_enumerator.rb +1 -1
- data/lib/kitchen/version.rb +1 -1
- data/lib/locales/en.yml +5 -1
- data/lib/locales/es.yml +33 -0
- data/lib/locales/pl.yml +3 -2
- data/lib/openstax_kitchen.rb +2 -5
- data/openstax_kitchen.gemspec +1 -0
- metadata +66 -25
- data/.github/config.yml +0 -14
- data/lib/kitchen/directions/bake_book_answer_key/eob_solutions_container.xhtml.erb +0 -9
- data/lib/kitchen/directions/bake_book_answer_key/main.rb +0 -11
- data/lib/kitchen/directions/bake_book_answer_key/v1.rb +0 -13
- data/lib/kitchen/directions/bake_chapter_glossary.rb +0 -39
- data/lib/kitchen/directions/bake_chapter_key_concepts/key_concepts.xhtml.erb +0 -16
- data/lib/kitchen/directions/bake_chapter_review/chapter_review.xhtml.erb +0 -9
- data/lib/kitchen/directions/bake_chapter_review/v1.rb +0 -13
- data/lib/kitchen/directions/bake_chapter_review_exercises/main.rb +0 -15
- data/lib/kitchen/directions/bake_chapter_review_exercises/review_exercises.xhtml.erb +0 -10
- data/lib/kitchen/directions/bake_exercises/main.rb +0 -12
- data/lib/kitchen/directions/bake_exercises/v1.rb +0 -169
- data/lib/kitchen/directions/bake_notes/bake_notes.rb +0 -48
- data/lib/kitchen/directions/bake_notes/bake_numbered_notes.rb +0 -63
- data/lib/kitchen/directions/bake_problem_first_elements.rb +0 -16
- data/lib/kitchen/transliterations.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 544eb8b780fd248111e4dc9738c32b7edfefc101fbf6abd82f25c01bada69708
|
4
|
+
data.tar.gz: c3f1e2658259f5d9a04dde8aa188793c3c82e8ef6a4f6c1354e2b50d5ed7982d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1829a8193fd8d53e2eaa4d91bd00417eb439b1dce3e690b865ff7741d3aad8637282a680f7840842180bfd811cbd79d7275b1c75502fdbcb72d39ed81572b905
|
7
|
+
data.tar.gz: 6cf08743860774a7f7b6fa73d26d4adbc56d7e2849e2178fc020456f113774942d23f7f14f2a5f02393c43cbfa0312b787bbb8a1adbdca4943fd76cb697ff9c0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: CHANGELOG.md
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
exists:
|
11
|
+
timeout-minutes: 10
|
12
|
+
runs-on: ubuntu-18.04
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
with:
|
17
|
+
fetch-depth: 0
|
18
|
+
- name: Check for CHANGELOG.md in this PR
|
19
|
+
# https://dev.to/scienta/get-changed-files-in-github-actions-1p36
|
20
|
+
run: |
|
21
|
+
if [[ $(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep CHANGELOG.md) ]]; then
|
22
|
+
echo "CHANGELOG.md is included in the pull request! Way to go!"
|
23
|
+
exit 0
|
24
|
+
else
|
25
|
+
echo "CHANGELOG.md was not modified in this pull request. Boo!"
|
26
|
+
exit 1
|
27
|
+
fi
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
lint:
|
11
|
+
timeout-minutes: 10
|
12
|
+
runs-on: ubuntu-18.04
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
with:
|
17
|
+
fetch-depth: 0
|
18
|
+
- uses: actions/cache@v2
|
19
|
+
with:
|
20
|
+
path: vendor/bundle
|
21
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
22
|
+
restore-keys: |
|
23
|
+
${{ runner.os }}-gems-
|
24
|
+
- name: Build docker image and run rubocop within it
|
25
|
+
# See https://docs.codecov.io/docs/testing-with-docker
|
26
|
+
run: |
|
27
|
+
./docker/build --ci
|
28
|
+
./docker/rubocop ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,8 +6,101 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
## [3.2.0] - 2021-04-19
|
10
9
|
|
10
|
+
## [6.0.0] - 2021-06-15
|
11
|
+
|
12
|
+
* Allow `BakeChapterSummary` to skip pages where there is no summary (minor)
|
13
|
+
* Change `PageElement#summary` to return nil instead of raise an error if no matches (major?)
|
14
|
+
* Fix bug in `BakeNumberedNotes:::V3` when there are multiple os-numbers (minor)
|
15
|
+
* Add Rubocop and a working CHANGELOG check to GitHub actions (patch)
|
16
|
+
* Allow `BakeFootnotes` to number footnotes with Roman numerals (minor)
|
17
|
+
* Create V2 for `BakeNumberedTables` (minor)
|
18
|
+
* Remove extraneous title in `BakeChapterSectionExercises` (minor)
|
19
|
+
* Create V2 for `BookAnswerKeyContainer` and `MoveSolutionsToEOC` with singular option for wrapper class (minor)
|
20
|
+
* Delete `abstract` and `description` elements from preface in `BakePreface` (minor)
|
21
|
+
* Stop deleting the first `<strong>` tag in `BakeNumberedNotes` (major)
|
22
|
+
* Allow `BakeFigure` to bake unnumbered splash figures (minor)
|
23
|
+
* Extend `ChapterReviewContainer` to accept other classes (major?)
|
24
|
+
* Add a `Strategy` for Precalculus (minor)
|
25
|
+
* Create a `BakeNumberedNotes` V2 (minor)
|
26
|
+
* Added a version of `BakeChapterIntroductions` without a chapter outline (minor)
|
27
|
+
* Add `BakeChapterSolutions` which bakes the free response solutions at the eoc (minor)
|
28
|
+
* Changed locale `eoc_answer_key_title` to `answer_key_title` as it was only used in eob (major)
|
29
|
+
* Added spec for translations (minor)
|
30
|
+
* Remove summary attribute from numbered tables, add option to pass title element to `BakePreface` (minor)
|
31
|
+
* Renamed `American Government` strategy to `Default` inside `move_solutions_to_answer_key` for other books to use it with a sent in classname (major)
|
32
|
+
* Adds `#previous` method to note_elements to find the immediately previous element (minor)
|
33
|
+
* Adds `BakeNumberedNotes` V3 (minor)
|
34
|
+
* Added line that puts the classname `has-footnote` in the footnote ref's parent element (major)
|
35
|
+
* Added a condition into `BakeChapterSummary` so it doesn't bake the title if it already includes the respective number in it
|
36
|
+
* Create v3 of MoveExercisesToEOC which differs from v1 by the presence of a section title
|
37
|
+
and from v2 the lack of additional "os-section-area" and os-#{@klass} wrapper (minor)
|
38
|
+
* Add a condition in BakeNumberedExercise to make it possible to suppress even solutions in the Answer Key (minor)
|
39
|
+
* Fix BakeFurtherResearch baking with main bake script error by breaking the loop if further research sections are not present (minor)
|
40
|
+
* 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
|
+
|
42
|
+
## [5.0.0] - 2021-06-02
|
43
|
+
|
44
|
+
* Reditributed duplicated id logic across `#record_id_copied`, `#record_id_cut`, `#record_id_pasted`, added a couple more tests for `#copy`, `#cut`, and `#paste`, created a new class `IdTracker` and moved `#record_id_copied`, `#record_id_cut`, `#record_id_pasted`, and `modified_id_to_paste` into the new class (major)
|
45
|
+
* Moved selectors from recipe to kitchen on `BakeFirstElements` Direction (minor)
|
46
|
+
* Auto-detect language based on document; force output encoding to UTF-8 (major)
|
47
|
+
* Switched to using a library to sort strings in a language-specific way (patch)
|
48
|
+
* Remove summary attribute from `BakeNumberedTable` (major)
|
49
|
+
|
50
|
+
## [4.1.1] - 2021-05-24
|
51
|
+
|
52
|
+
* Adds low level Nokogiri caching, disabled by default (patch)
|
53
|
+
* Cache Selector objects since they don't change (patch)
|
54
|
+
* Use more specific selectors when to reduce bake time (patch)
|
55
|
+
|
56
|
+
## [4.1.0] - 2021-05-18
|
57
|
+
|
58
|
+
* Fixed performance problem with element class detection (patch)
|
59
|
+
* Added `BakeChapterReferences` Directions (minor)
|
60
|
+
|
61
|
+
## [4.0.0] - 2021-05-18
|
62
|
+
|
63
|
+
* Changes `default_css_or_xpath` to optionally be a proc to be evaluated w.r.t. a document's config (minor)
|
64
|
+
* Support namespaces defined on elements other than the root (minor)
|
65
|
+
* Non-splash figures now treated like normal intro-body content in `BakeChapterIntroductions`
|
66
|
+
* `BakeNumberedNotes` and the uphysics strategy for `MoveSolutionsToAnswerKey` updated to accomodate multiple exercises in a note.
|
67
|
+
* `BakeFootnotes` now looks for footnotes in composite chapters
|
68
|
+
* Move exercise pantry label storage to `BakeNumberedExercises` to ensure consistency between exercise number and link text
|
69
|
+
* Update `BakeIndex` term capitalization handling to be less case sensitive (minor)
|
70
|
+
* Added a title tag variable to choose between h2 and h3 for children of chapter review (minor)
|
71
|
+
* Added a fix for examples not to bake table captions (minor)
|
72
|
+
* Replaced a .text with .children to include math text (minor)
|
73
|
+
* Changed title tag on numbered notes to always be h3 (major)
|
74
|
+
* Storing all note subtitles in the pantry for link placeholders (minor)
|
75
|
+
* Added another xmlns string option to remove if clone (minor)
|
76
|
+
* Add class to reference superscript & add metadata to `BakeSuggestedReading` (minor)
|
77
|
+
* Add `BakeFreeResponse` Directions (minor)
|
78
|
+
* Add terms from composite pages to index (minor)
|
79
|
+
* Access `.pantry` and `.clipboard` through an element instead of just its document (minor)
|
80
|
+
* Add `suppress_solution` option to `BakeNumberedExercise` (minor)
|
81
|
+
* Add strategy for American Government answer key (minor)
|
82
|
+
* Add `BakeReferences` direction (minor)
|
83
|
+
* Fix xmlns string replacement done in PR #209 (minor)
|
84
|
+
* Move title above metadata in `BakeSuggestedReading` direction (major)
|
85
|
+
* Remove depreciated directions `BakeNotes` and `BakeExercises` (major)
|
86
|
+
* Adds `eoc_composite_metadata_title` to en.yml and eoc template (major)
|
87
|
+
* Add `template` folder to kitchen to hold templates (minor)
|
88
|
+
* Add `eoc_section_title_template` (minor)
|
89
|
+
* Expand specs with `append_to` to have with/without `append_to` contexts (minor)
|
90
|
+
* Add `is?` method to `ElementBase` (minor)
|
91
|
+
* Replaced in_composite_chapter to use `is?` (minor)
|
92
|
+
* Add callable `short_type` to Elements (minor)
|
93
|
+
* Add template for eob titles - `eob_section_title_template` (minor)
|
94
|
+
|
95
|
+
## [3.2.0] - 2021-04-20
|
96
|
+
|
97
|
+
* Adds method to allow unit and page title text to be retrieved regardless of bake status (minor)
|
98
|
+
* Rename several directions (major)
|
99
|
+
* `BakeChapterReviewExercises` -> `MoveExercisesToEOC`
|
100
|
+
* `BakeChapterReview` -> `ChapterReviewContainer`
|
101
|
+
* `BakeBookAnswerKey` -> `BookAnswerKeyContainer`
|
102
|
+
* `BakeChapterAnswerKey` -> `MoveSolutionsToAnswerKey`
|
103
|
+
* Refactors `BakeFirstElements` and `BakeNumberedExercise` (minor)
|
11
104
|
* Adds a decorating option of equation numbers on `BakeEquations` (minor)
|
12
105
|
|
13
106
|
## [3.1.0] - 2021-04-19
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openstax_kitchen (
|
4
|
+
openstax_kitchen (6.0.0)
|
5
5
|
activesupport
|
6
6
|
i18n
|
7
7
|
nokogiri
|
8
8
|
rainbow
|
9
|
+
twitter_cldr
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
activesupport (6.
|
14
|
+
activesupport (6.1.3.2)
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
18
|
-
zeitwerk (~> 2.
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
19
20
|
ast (2.4.1)
|
20
21
|
byebug (11.1.2)
|
21
|
-
|
22
|
-
|
22
|
+
camertron-eprun (1.1.1)
|
23
|
+
cldr-plurals-runtime-rb (1.1.0)
|
24
|
+
codecov (0.5.2)
|
25
|
+
simplecov (>= 0.15, < 0.22)
|
23
26
|
coderay (1.1.3)
|
24
|
-
concurrent-ruby (1.1.
|
27
|
+
concurrent-ruby (1.1.9)
|
25
28
|
diff-lcs (1.3)
|
26
|
-
docile (1.
|
27
|
-
i18n (1.8.
|
29
|
+
docile (1.4.0)
|
30
|
+
i18n (1.8.10)
|
28
31
|
concurrent-ruby (~> 1.0)
|
29
32
|
inch (0.8.0)
|
30
33
|
pry
|
@@ -33,7 +36,7 @@ GEM
|
|
33
36
|
yard (~> 0.9.12)
|
34
37
|
method_source (1.0.0)
|
35
38
|
mini_portile2 (2.5.0)
|
36
|
-
minitest (5.14.
|
39
|
+
minitest (5.14.4)
|
37
40
|
nokogiri (1.11.1)
|
38
41
|
mini_portile2 (~> 2.5.0)
|
39
42
|
racc (~> 1.4)
|
@@ -52,7 +55,7 @@ GEM
|
|
52
55
|
rainbow (3.0.0)
|
53
56
|
rake (12.3.3)
|
54
57
|
regexp_parser (2.0.1)
|
55
|
-
rexml (3.2.
|
58
|
+
rexml (3.2.5)
|
56
59
|
rspec (3.9.0)
|
57
60
|
rspec-core (~> 3.9.0)
|
58
61
|
rspec-expectations (~> 3.9.0)
|
@@ -83,23 +86,28 @@ GEM
|
|
83
86
|
rubocop (~> 1.0)
|
84
87
|
rubocop-ast (>= 1.1.0)
|
85
88
|
ruby-progressbar (1.10.1)
|
86
|
-
simplecov (0.
|
89
|
+
simplecov (0.21.2)
|
87
90
|
docile (~> 1.1)
|
88
91
|
simplecov-html (~> 0.11)
|
92
|
+
simplecov_json_formatter (~> 0.1)
|
89
93
|
simplecov-html (0.12.3)
|
94
|
+
simplecov_json_formatter (0.1.3)
|
90
95
|
sparkr (0.4.1)
|
91
96
|
sync (0.5.0)
|
92
97
|
tdiff (0.3.4)
|
93
98
|
term-ansicolor (1.7.1)
|
94
99
|
tins (~> 1.0)
|
95
|
-
thread_safe (0.3.6)
|
96
100
|
tins (1.26.0)
|
97
101
|
sync
|
98
|
-
|
99
|
-
|
102
|
+
twitter_cldr (6.6.0)
|
103
|
+
camertron-eprun
|
104
|
+
cldr-plurals-runtime-rb (~> 1.1)
|
105
|
+
tzinfo
|
106
|
+
tzinfo (2.0.4)
|
107
|
+
concurrent-ruby (~> 1.0)
|
100
108
|
unicode-display_width (1.7.0)
|
101
109
|
yard (0.9.24)
|
102
|
-
zeitwerk (2.4.
|
110
|
+
zeitwerk (2.4.2)
|
103
111
|
|
104
112
|
PLATFORMS
|
105
113
|
ruby
|
data/README.md
CHANGED
@@ -641,6 +641,22 @@ expect(book_1).to match_normalized_html("some string of HTML here")
|
|
641
641
|
expect(book_1).to match_html_nodes("some string of HTML here")
|
642
642
|
```
|
643
643
|
|
644
|
+
### Profiling
|
645
|
+
|
646
|
+
If you set the `PROFILE` environment variable to something before you run specs or a recipe, search query profile data will be collected and printed, e.g.
|
647
|
+
|
648
|
+
```bash
|
649
|
+
%> PROFILE=1 rspec
|
650
|
+
```
|
651
|
+
|
652
|
+
### Caching
|
653
|
+
|
654
|
+
There's a low-level CSS query caching tool that saves repeated queries. In some tests, it saves 15% of query time. It is disabled by default (because we aren't super sure that it is completely safe) but can be turned on with
|
655
|
+
|
656
|
+
```ruby
|
657
|
+
doc.config.enable_search_cache = true
|
658
|
+
```
|
659
|
+
|
644
660
|
### VSCode
|
645
661
|
|
646
662
|
1. Visit `vscode:extension/ms-vscode-remote.remote-containers` in a browser
|
data/codecov.yaml
CHANGED
data/docker/ci
CHANGED
@@ -10,7 +10,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
10
10
|
docker run $CI_ENV \
|
11
11
|
-e ENABLE_CODECOV=1 -e CI=true \
|
12
12
|
-v $DIR/..:/code \
|
13
|
-
-v vendor/bundle \
|
14
13
|
-w /code \
|
15
14
|
openstax/kitchen.ci:latest \
|
16
15
|
/bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rspec"
|
data/docker/rubocop
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# set -x
|
4
|
+
|
5
|
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
6
|
+
|
7
|
+
from="${1:-main}"
|
8
|
+
to="${2:-HEAD}"
|
9
|
+
|
10
|
+
echo "Checking from $from to $to"
|
11
|
+
|
12
|
+
# https://dev.to/scienta/get-changed-files-in-github-actions-1p36
|
13
|
+
changed_ruby_files=$(git diff --name-only --diff-filter=ACMRT $from $to | grep -E "(lib\/|spec\/)*.rb$" | xargs)
|
14
|
+
|
15
|
+
if [[ -z "${changed_ruby_files// }" ]]; then
|
16
|
+
echo "No files to lint with Rubocop"
|
17
|
+
else
|
18
|
+
docker run -v $DIR/..:/code \
|
19
|
+
-w /code \
|
20
|
+
openstax/kitchen.ci:latest \
|
21
|
+
/bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rubocop $changed_ruby_files --disable-pending-cops"
|
22
|
+
fi
|
data/lib/kitchen/book_element.rb
CHANGED
@@ -13,8 +13,14 @@ module Kitchen
|
|
13
13
|
def initialize(node:, document: nil)
|
14
14
|
super(node: node,
|
15
15
|
document: document,
|
16
|
-
enumerator_class: BookElementEnumerator
|
17
|
-
|
16
|
+
enumerator_class: BookElementEnumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns the short type
|
20
|
+
# @return [Symbol]
|
21
|
+
#
|
22
|
+
def self.short_type
|
23
|
+
:book
|
18
24
|
end
|
19
25
|
|
20
26
|
# Returns the "body" element
|
@@ -41,5 +47,13 @@ module Kitchen
|
|
41
47
|
first!('nav#toc')
|
42
48
|
end
|
43
49
|
|
50
|
+
# Returns true if this class represents the element for the given node
|
51
|
+
#
|
52
|
+
# @param node [Nokogiri::XML::Node] the underlying node
|
53
|
+
# @return [Boolean]
|
54
|
+
#
|
55
|
+
def self.is_the_element_class_for?(node, **)
|
56
|
+
node.name == 'body'
|
57
|
+
end
|
44
58
|
end
|
45
59
|
end
|
@@ -13,8 +13,14 @@ module Kitchen
|
|
13
13
|
def initialize(node:, document: nil)
|
14
14
|
super(node: node,
|
15
15
|
document: document,
|
16
|
-
enumerator_class: ChapterElementEnumerator
|
17
|
-
|
16
|
+
enumerator_class: ChapterElementEnumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns the short type
|
20
|
+
# @return [Symbol]
|
21
|
+
#
|
22
|
+
def self.short_type
|
23
|
+
:chapter
|
18
24
|
end
|
19
25
|
|
20
26
|
# Returns the title element (the one in the immediate children, not the one in the metadata)
|
@@ -35,7 +41,7 @@ module Kitchen
|
|
35
41
|
# @return [Element, nil]
|
36
42
|
#
|
37
43
|
def introduction_page
|
38
|
-
pages('
|
44
|
+
pages('$.introduction').first
|
39
45
|
end
|
40
46
|
|
41
47
|
# Returns an enumerator for the glossaries
|
@@ -59,16 +65,7 @@ module Kitchen
|
|
59
65
|
# @return [ElementEnumerator]
|
60
66
|
#
|
61
67
|
def abstracts
|
62
|
-
search('[data-type="abstract"]')
|
63
|
-
end
|
64
|
-
|
65
|
-
# Returns true if this class represents the element for the given node
|
66
|
-
#
|
67
|
-
# @param node [Nokogiri::XML::Node] the underlying node
|
68
|
-
# @return [Boolean]
|
69
|
-
#
|
70
|
-
def self.is_the_element_class_for?(node)
|
71
|
-
node['data-type'] == 'chapter'
|
68
|
+
search('div[data-type="abstract"]')
|
72
69
|
end
|
73
70
|
|
74
71
|
end
|
@@ -11,7 +11,7 @@ module Kitchen
|
|
11
11
|
#
|
12
12
|
def self.factory
|
13
13
|
ElementEnumeratorFactory.new(
|
14
|
-
default_css_or_xpath:
|
14
|
+
default_css_or_xpath: Selector.named(:chapter),
|
15
15
|
sub_element_class: ChapterElement,
|
16
16
|
enumerator_class: self
|
17
17
|
)
|
@@ -13,8 +13,13 @@ module Kitchen
|
|
13
13
|
def initialize(node:, document: nil)
|
14
14
|
super(node: node,
|
15
15
|
document: document,
|
16
|
-
enumerator_class: ElementEnumerator
|
17
|
-
|
16
|
+
enumerator_class: ElementEnumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns short type
|
20
|
+
#
|
21
|
+
def self.short_type
|
22
|
+
:composite_chapter
|
18
23
|
end
|
19
24
|
|
20
25
|
# Returns the title element (the one in the immediate children, not the one in the metadata)
|
@@ -29,14 +34,5 @@ module Kitchen
|
|
29
34
|
first!("./*[@data-type = 'document-title']")
|
30
35
|
end
|
31
36
|
|
32
|
-
# Returns true if this class represents the element for the given node
|
33
|
-
#
|
34
|
-
# @param node [Nokogiri::XML::Node] the underlying node
|
35
|
-
# @return [Boolean]
|
36
|
-
#
|
37
|
-
def self.is_the_element_class_for?(node)
|
38
|
-
node['data-type'] == 'composite-chapter'
|
39
|
-
end
|
40
|
-
|
41
37
|
end
|
42
38
|
end
|