6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/kitchen/directions/bake_table_columns.rb', line 6
def self.v1(book:)
book.tables.each do |table|
columns = table.search('col').count
next if columns <= 1
table['data-columns'] = columns.to_s
ratio_list = []
table.search('col').each do |column|
if column['data-width'].nil?
warn "warning! colwidth attribute is missing in table: data-sm=#{table['data-sm']}"
next
end
ratio = column['data-width'].gsub('*', '')
ratio_list.push(ratio)
end
table['data-ratio'] = ratio_list.join(',')
end
end
|