|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +PL_NURSING_RECIPE = Kitchen::BookRecipe.new(book_short_name: :plnursing) do |doc, _resources| |
| 4 | + include Kitchen::Directions |
| 5 | + |
| 6 | + doc.selectors.override( |
| 7 | + reference: 'section.references' |
| 8 | + ) |
| 9 | + book = doc.book |
| 10 | + metadata = book.metadata |
| 11 | + |
| 12 | + book.search('cnx-pi').trash |
| 13 | + |
| 14 | + BakeListsWithPara.v1(book: book) |
| 15 | + BakeUnnumberedFigure.v1(book: book) |
| 16 | + BakePreface.v1(book: book, cases: true) |
| 17 | + |
| 18 | + BakeChapterIntroductions.v2( |
| 19 | + book: book, options: { |
| 20 | + strategy: :add_objectives, |
| 21 | + bake_chapter_outline: true, |
| 22 | + introduction_order: :v3, |
| 23 | + cases: true, |
| 24 | + authors: true |
| 25 | + } |
| 26 | + ) |
| 27 | + BakeChapterTitle.v1(book: book, cases: true) |
| 28 | + |
| 29 | + answer_key = BookAnswerKeyContainer.v1(book: book) |
| 30 | + |
| 31 | + book.chapters.each do |chapter| |
| 32 | + BakeNonIntroductionPages.v1(chapter: chapter, options: { cases: true }) |
| 33 | + BakeLearningObjectives.v2(chapter: chapter, add_title: false) |
| 34 | + |
| 35 | + chapter.figures(only: :figure_to_number?).each do |figure| |
| 36 | + BakeFigure.v1(figure: figure, |
| 37 | + number: "#{chapter.count_in(:book)}.#{figure.count_in(:chapter)}", |
| 38 | + cases: true) |
| 39 | + end |
| 40 | + |
| 41 | + chapter.tables('$:not(.unnumbered)').each do |table| |
| 42 | + BakeNumberedTable.v1(table: table, |
| 43 | + number: "#{chapter.count_in(:book)}.#{table.count_in(:chapter)}", |
| 44 | + cases: true) |
| 45 | + end |
| 46 | + |
| 47 | + # EOC |
| 48 | + MoveCustomSectionToEocContainer.v1( |
| 49 | + chapter: chapter, |
| 50 | + metadata_source: metadata, |
| 51 | + container_key: 'chapter-summary', |
| 52 | + uuid_key: '.chapter-summary', |
| 53 | + section_selector: 'section.chapter-summary' |
| 54 | + ) do |section| |
| 55 | + RemoveSectionTitle.v1(section: section) |
| 56 | + end |
| 57 | + |
| 58 | + BakeSortableSection.v1( |
| 59 | + chapter: chapter, |
| 60 | + metadata_source: metadata, |
| 61 | + klass: 'suggested-reading' |
| 62 | + ) |
| 63 | + |
| 64 | + BakeChapterGlossary.v1(chapter: chapter, metadata_source: metadata, has_para: true) |
| 65 | + |
| 66 | + MoveCustomSectionToEocContainer.v1( |
| 67 | + chapter: chapter, |
| 68 | + metadata_source: metadata, |
| 69 | + container_key: 'review-questions', |
| 70 | + uuid_key: '.review-questions', |
| 71 | + section_selector: 'section.review-questions' |
| 72 | + ) do |section| |
| 73 | + RemoveSectionTitle.v1(section: section) |
| 74 | + end |
| 75 | + |
| 76 | + BakeAllNumberedExerciseTypes.v1( |
| 77 | + within: chapter.search('section.review-questions'), |
| 78 | + exercise_options: { cases: true } |
| 79 | + ) |
| 80 | + |
| 81 | + BakeAllNumberedExerciseTypes.v1( |
| 82 | + within: chapter.pages.notes('$.unfolding-casestudy'), |
| 83 | + exercise_options: { cases: true } |
| 84 | + ) |
| 85 | + |
| 86 | + answer_key_inner_container = AnswerKeyInnerContainer.v1( |
| 87 | + chapter: chapter, metadata_source: metadata, append_to: answer_key, options: { cases: true } |
| 88 | + ) |
| 89 | + |
| 90 | + Kitchen::Directions::MoveSolutionsFromNumberedNote.v1( |
| 91 | + chapter: chapter, append_to: answer_key_inner_container, note_class: 'unfolding-casestudy' |
| 92 | + ) |
| 93 | + |
| 94 | + Kitchen::Directions::MoveSolutionsFromExerciseSection.v1( |
| 95 | + within: chapter, append_to: answer_key_inner_container, section_class: 'review-questions' |
| 96 | + ) |
| 97 | + |
| 98 | + chapter.exercises.each do |exercise| |
| 99 | + BakeFirstElements.v1(within: exercise) |
| 100 | + end |
| 101 | + end |
| 102 | + |
| 103 | + note_classes = %w[special-considerations clinical-tip safety-alert |
| 104 | + unfolding-casestudy trending-today] |
| 105 | + |
| 106 | + BakeAutotitledNotes.v1(book: book, classes: note_classes, options: { cases: true }) |
| 107 | + BakeCustomTitledNotes.v1(book: book, classes: %w[media-feature]) |
| 108 | + BakeUnclassifiedNotes.v1(book: book) |
| 109 | + BakeUnnumberedTables.v1(book: book) |
| 110 | + BakeTableColumns.v1(book: book) |
| 111 | + BakeIframes.v1(book: book) |
| 112 | + BakeUnitTitle.v1(book: book) |
| 113 | + BakeReferences.v4(book: book, metadata_source: metadata, cases: true) |
| 114 | + BakeIndex.v1(book: book, types: %w[name term foreign], uuid_prefix: '.') |
| 115 | + BakeCompositePages.v1(book: book) |
| 116 | + BakeCompositeChapters.v1(book: book) |
| 117 | + BakeToc.v1(book: book, options: { cases: true }) |
| 118 | + BakeFolio.v1(book: book) |
| 119 | + BakeRexWrappers.v1(book: book) |
| 120 | + BakeLinks.v1(book: book) |
| 121 | + BakeLinkPlaceholders.v1(book: book, cases: true) |
| 122 | +end |
0 commit comments