Sha256: 2f6baff08ee51061d77f510b4613b1401c3c81fd5763f22c0f095688aebfb7c6

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module Kitchen
  module Directions
    # Bakes inline lists with the desired list separator
    # Does not separate the last list item
    #
    module BakeInlineLists
      LIST_SEPARATOR = '; '
      SEPARATOR_CLASS = '-os-inline-list-separator'

      def self.v1(book:)
        inline_lists = book.search('span[data-display="inline"][data-type="list"]')
        inline_lists.each do |list|
          list.search('span[data-type="item"]')[0..-2].each do |item|
            item.append(child: "<span class=\"#{SEPARATOR_CLASS}\">#{LIST_SEPARATOR}</span>")
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
openstax_kitchen-9.0.0 lib/kitchen/directions/bake_inline_lists.rb
openstax_kitchen-8.0.1 lib/kitchen/directions/bake_inline_lists.rb
openstax_kitchen-8.0.0 lib/kitchen/directions/bake_inline_lists.rb
openstax_kitchen-7.0.0 lib/kitchen/directions/bake_inline_lists.rb
openstax_kitchen-6.1.0 lib/kitchen/directions/bake_inline_lists.rb