class Kitchen::Directions::BakeTableBody::V1

Public Instance Methods

bake(table:, number:, cases: false) click to toggle source
# File lib/kitchen/directions/bake_numbered_table/bake_table_body.rb, line 39
def bake(table:, number:, cases: false)
  table.remove_attribute('summary')
  table.wrap(%(<div class="os-table">))

  # Store label information
  table.target_label(label_text: 'table', custom_content: number, cases: cases)

  if table.top_titled?
    custom_table = CustomBody.new(table: table,
                                  klass: 'top-titled',
                                  fake_title_class: 'os-table-title',
                                  fake_title: table.title,
                                  to_trash: table.title_row)

    custom_table.modify_body(has_fake_title: true)
  elsif table.top_captioned?
    custom_table = CustomBody.new(table: table,
                                  klass: 'top-captioned',
                                  fake_title_class: 'os-top-caption',
                                  fake_title: table.caption_title,
                                  to_trash: table.top_caption)

    custom_table.modify_body(has_fake_title: true)
  elsif table.column_header?
    custom_table = CustomBody.new(table: table, klass: 'column-header')
    custom_table.modify_body(has_fake_title: false)
  end
end