Sha256: 7dd8216cd18c0b4d4028e82f43ff798eaf1961b288b8c12c3ef4df837cdb95ca

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module Kitchen
  module Directions
    # Bake directons for eoc key equations
    #
    module BakeChapterKeyEquations
      def self.v1(chapter:, metadata_source:, append_to: nil, uuid_prefix: '.')
        V1.new.bake(
          chapter: chapter,
          metadata_source: metadata_source,
          append_to: append_to,
          uuid_prefix: uuid_prefix
        )
      end

      class V1
        renderable
        def bake(chapter:, metadata_source:, append_to:, uuid_prefix:)
          @metadata = metadata_source.children_to_keep.copy
          @klass = 'key-equations'
          @title = I18n.t(:eoc_key_equations)
          @uuid_prefix = uuid_prefix

          chapter.key_equations.search('h3').trash

          return if chapter.key_equations.none?

          @content = chapter.key_equations.cut.paste

          append_to_element = append_to || chapter
          @in_composite_chapter = append_to_element.is?(:composite_chapter)

          append_to_element.append(child: render(file:
            '../templates/eoc_section_title_template.xhtml.erb'))
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
openstax_kitchen-8.0.1 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-8.0.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-7.0.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-6.1.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-6.0.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-5.0.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-4.1.1 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-4.1.0 lib/kitchen/directions/bake_chapter_key_equations.rb
openstax_kitchen-4.0.0 lib/kitchen/directions/bake_chapter_key_equations.rb