273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
# File 'lib/plurimath/latex/transform.rb', line 273
def organize_table(array, table = [], table_data = [], table_row = [])
array.each do |data|
if data.is_a?(Math::Symbol) && data.value == "&"
table_row << Math::Function::Td.new(table_data)
table_data = []
elsif data.is_a?(Math::Symbol) && data.value == "\\\\"
table_row << Math::Function::Td.new(table_data)
table << Math::Function::Tr.new(table_row.flatten)
table_row = []
table_data = []
else
table_data << data
end
end
table_row << Math::Function::Td.new(table_data) if table_data
table << Math::Function::Tr.new(table_row) unless table_row.empty?
table
end
|