Skip to content

Commit

Permalink
fix colgroup handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ikirudennis committed Aug 6, 2024
1 parent abb0581 commit 82fe31a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions textile/objects/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ def process(self):

# Colgroup -- A colgroup row will not necessarily end with a |.
# Hence it may include the next row of actual table data.

gmtch = self.colgroup_re.match(row)
if gmtch:
cols = gmtch.group(1).replace('.', "")
for idx, col in enumerate(cols.split("|")):
gatts = pba(col.strip(), 'col', restricted=self.textile.restricted)
self.colgroup += '\t<col{0}\n'.format(
('group' + gatts + '>') if idx == 0 else (gatts + ' />'))
self.colgroup += '\t</colgroup>'
nl_index = row.find('\n')
if nl_index >= 0:
row = row[nl_index:].lstrip()
if row[:2] == '|:':
if '\n' in row:
colgroup_data, row = row[2:].split('\n')
else:
colgroup_data, row = row[2:], ''
colgroup_atts, cols = colgroup_data, None
if '|' in colgroup_data:
colgroup_atts, cols = colgroup_data.split('|', 1)
colgrp = Colgroup(cols, colgroup_atts, restricted=self.textile.restricted)
self.colgroup = colgrp.process()
if row == '':
continue

# search the row for a table group - thead, tfoot, or tbody
Expand Down

0 comments on commit 82fe31a

Please sign in to comment.