Class: Kitchen::Directions::BakeTableBody::V1
- Defined in:
- lib/kitchen/directions/bake_numbered_table/bake_table_body.rb
Defined Under Namespace
Classes: CustomBody
Instance Method Summary collapse
Instance Method Details
#bake(table:, number:, cases: false) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# 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">)) table.search('th').each do |header| header[:scope] = 'col' end # Store label information table.target_label(label_text: 'table', custom_content: number, cases: cases) if table.top_titled? klass = table.text_heavy? ? 'text-heavy-top-titled' : 'top-titled' custom_table = CustomBody.new(table: table, klass: klass, 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. custom_table = CustomBody.new(table: table, klass: 'top-captioned', fake_title_class: 'os-top-caption', fake_title: table., to_trash: table.) 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) elsif table.text_heavy? custom_table = CustomBody.new(table: table, klass: 'text-heavy') custom_table.modify_body(has_fake_title: false) elsif table.unstyled? custom_table = CustomBody.new(table: table, klass: 'unstyled') custom_table.modify_body(has_fake_title: false) end end |