mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
doc: wikiparser: Generate colspec for tables
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
e947e99af3
commit
64fedf1f32
@ -414,7 +414,10 @@ class Table(Element):
|
|||||||
|
|
||||||
def to_docbook(self, context=None):
|
def to_docbook(self, context=None):
|
||||||
cols = len(self.rows[0]) if self.rows else 0
|
cols = len(self.rows[0]) if self.rows else 0
|
||||||
xml = f'<informaltable><tgroup cols="{cols}"><tbody>'
|
xml = f'<informaltable><tgroup cols="{cols}">'
|
||||||
|
for number in range(cols):
|
||||||
|
xml += f'<colspec colname="col_{number}"/>'
|
||||||
|
xml += '<tbody>'
|
||||||
for row in self.rows:
|
for row in self.rows:
|
||||||
xml += row.to_docbook(context)
|
xml += row.to_docbook(context)
|
||||||
xml += '</tbody></tgroup></informaltable>'
|
xml += '</tbody></tgroup></informaltable>'
|
||||||
@ -1502,7 +1505,10 @@ TableItem([Paragraph([PlainText('A')])]), \
|
|||||||
TableItem([Paragraph([PlainText('B')])])]), \
|
TableItem([Paragraph([PlainText('B')])])]), \
|
||||||
TableRow([TableItem([Paragraph([PlainText('1')])]), \
|
TableRow([TableItem([Paragraph([PlainText('1')])]), \
|
||||||
TableItem([Paragraph([PlainText('2')])])])])])
|
TableItem([Paragraph([PlainText('2')])])])])])
|
||||||
'<informaltable><tgroup cols="2"><tbody>\
|
'<informaltable><tgroup cols="2">\
|
||||||
|
<colspec colname="col_0"/>\
|
||||||
|
<colspec colname="col_1"/>\
|
||||||
|
<tbody>\
|
||||||
<row rowsep="1">\
|
<row rowsep="1">\
|
||||||
<entry colsep="1" rowsep="1"><para>A</para></entry>\
|
<entry colsep="1" rowsep="1"><para>A</para></entry>\
|
||||||
<entry colsep="1" rowsep="1"><para>B</para></entry></row>\
|
<entry colsep="1" rowsep="1"><para>B</para></entry></row>\
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user