Sha256: 451efab439ea85add86b46e5700dc95c0c5ce320ab761e934e19b23f31b1ef0c

Contents?: true

Size: 794 Bytes

Versions: 14

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

module Kitchen::Directions::BakeTheorem
  class V1
    def bake(theorem:, number:)
      theorem['use-subtitle'] = true
      new_subtitle = theorem.title.cut

      theorem.wrap_children(class: 'os-note-body')
      note_body = theorem.first('.os-note-body')

      note_body.prepend(sibling:
        <<~HTML
          <div class="os-title">
            <span class="os-title-label">#{I18n.t(:theorem)} </span>
            <span class="os-number">#{number}</span>
            <span class="os-divider"> </span>
          </div>
        HTML
      )

      new_subtitle.name = 'h4'
      new_subtitle.add_class('os-subtitle')
      new_subtitle.children.wrap('<span class="os-subtitle-label">')
      note_body.prepend(child: new_subtitle.paste)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
openstax_kitchen-9.2.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-9.1.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-9.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-8.0.1 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-8.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-7.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-6.1.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-6.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-5.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-4.1.1 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-4.1.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-4.0.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-3.2.0 lib/kitchen/directions/bake_theorem/v1.rb
openstax_kitchen-3.1.0 lib/kitchen/directions/bake_theorem/v1.rb