Sha256: 0e519e89c23bfa69eeb4d9262a43e58ac219095b2ced4981e4b36cf17986f76c

Contents?: true

Size: 987 Bytes

Versions: 3

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  module Directions
    module BakeFigure
      def self.v1(figure:, number:)
        figure.wrap(%(<div class="os-figure#{' has-splash' if figure.has_class?('splash')}">))

        figure.document.pantry(name: :link_text).store "#{I18n.t(:figure)} #{number}", label: figure.id
        title = figure.title&.cut

        caption = figure.caption&.cut
        figure.append(sibling:
          <<~HTML
            <div class="os-caption-container">
              <span class="os-title-label">#{I18n.t(:figure)} </span>
              <span class="os-number">#{number}</span>
              <span class="os-divider"> </span>
              #{"<span class=\"os-title\" data-type=\"title\" id=\"#{title.id}\">#{title.children}</span>" if title}
              <span class="os-divider"> </span>
              #{"<span class=\"os-caption\">#{caption.children}</span>" if caption}
            </div>
          HTML
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openstax_kitchen-3.2.0 lib/kitchen/directions/bake_figure.rb
openstax_kitchen-3.1.0 lib/kitchen/directions/bake_figure.rb
openstax_kitchen-3.0.0 lib/kitchen/directions/bake_figure.rb