Sha256: 5fc9122c943780730774ab0a7991cbf21bb68e7bc35c0219e741983dc455a7c9
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Kitchen::Directions::BakeChapterReviewExercises class V1 renderable def bake(chapter:, metadata_source:, append_to:, klass:) @klass = klass @metadata = metadata_source.children_to_keep.copy @title = I18n.t(:"eoc.#{klass}") exercise_clipboard = Kitchen::Clipboard.new chapter.non_introduction_pages.each do |page| sections = page.search("section.#{@klass}") sections.each do |exercise_section| exercise_section.first("[data-type='title']")&.trash exercise_section.exercises.each do |exercise| exercise.document.pantry(name: :link_text).store( "#{I18n.t(:exercise_label)} #{chapter.count_in(:book)}.#{exercise.count_in(:chapter)}", label: exercise.id ) end exercise_section.cut(to: exercise_clipboard) end end return if exercise_clipboard.none? @content = exercise_clipboard.paste append_to.append(child: render(file: 'review_exercises.xhtml.erb')) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openstax_kitchen-3.2.0 | lib/kitchen/directions/bake_chapter_review_exercises/v1.rb |
openstax_kitchen-3.1.0 | lib/kitchen/directions/bake_chapter_review_exercises/v1.rb |