Sha256: 0aeb7afbbe061050d2775415cf2a8adf1060ef7817514de325e14276abf2b724
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module Kitchen::Directions::BakeNumberedTable class V1 def bake(table:, number:, always_caption: false) Kitchen::Directions::BakeTableBody.v1(table: table, number: number) # TODO: extra spaces added here to match legacy implementation, but probably not meaningful? new_caption = '' caption_title = '' if (title = table.first("span[data-type='title']")&.cut) caption_title = <<~HTML \n<span class="os-title" data-type="title">#{title.children}</span> HTML end if (caption = table.caption&.cut) new_caption = <<~HTML \n<span class="os-caption">#{caption.children}</span> HTML elsif always_caption new_caption = <<~HTML \n<span class="os-caption"></span> HTML end return if table.unnumbered? table.append(sibling: <<~HTML <div class="os-caption-container"> <span class="os-title-label">#{I18n.t(:table_label)} </span> <span class="os-number">#{number}</span> <span class="os-divider"> </span>#{caption_title} <span class="os-divider"> </span>#{new_caption} </div> HTML ) end end end
Version data entries
8 entries across 8 versions & 1 rubygems