You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the text builder can't handle all of the same tables that the html builder can. It is apparently possible for Table.colwidth elements to have a string value of 'auto', but Table.cell_width() assumes integer values.
...
File ".../docutils/nodes.py", line 199, in walkabout
visitor.dispatch_departure(self)
File ".../sphinx/util/docutils.py", line 599, in dispatch_departure
method(node)
File ".../sphinx/writers/text.py", line 903, in depart_table
self.add_text(str(self.table))
^^^^^^^^^^^^^^^
File ".../sphinx/writers/text.py", line 202, in __str__
self.rewrap()
File ".../sphinx/writers/text.py", line 181, in rewrap
cell.wrap(width=self.cell_width(cell, self.colwidth))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../sphinx/writers/text.py", line 163, in cell_width
width += source[cell.col + i]
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
The problem occurs with a table provided through the Breathe extension, but the html builder handles it just fine.
How to Reproduce
I'm sorry for the complexity of the example. I don't know what determines whether a table node has column widths that are integers versus 'auto'. In pure RsT parts of my doctree, a Table produces Table.colwidth == [50, 50]. For the table that comes through Breathe, I see Table.colwidth = ['auto', 'auto'], which builds fine for the html builder, but can't be processed by the text builder.
Create a doxygen comment block with a table using syntax like the following.
The HTML builder works fine because it doesn't care about the colwidth I think (we are just creating an HTML table and width is automatic).
The text builder doesn't compute its column width and plainly assumes that it's been given upon construction. So there is no dynamic recomputation every time you create a table. It's something we can easily fix, namely, you write everything in a matrix buffer, compute the colwidth if 'auto' and then voilà.
I diagnose the task's difficulty as "medium". You don't need expert skills but I wouldn't call the task 'easy'.
Describe the bug
It seems like the
text
builder can't handle all of the same tables that the html builder can. It is apparently possible forTable.colwidth
elements to have a string value of'auto'
, butTable.cell_width()
assumes integer values.The problem occurs with a table provided through the Breathe extension, but the html builder handles it just fine.
How to Reproduce
I'm sorry for the complexity of the example. I don't know what determines whether a table node has column widths that are integers versus
'auto'
. In pure RsT parts of my doctree, a Table producesTable.colwidth == [50, 50]
. For the table that comes through Breathe, I seeTable.colwidth = ['auto', 'auto']
, which builds fine for thehtml
builder, but can't be processed by thetext
builder.sphinx-build -b text . output/text
Environment Information
Sphinx extensions
Additional context
The content that is being processed when the error occurs is extracted by breathe (4.35.0) from XML produced by Doxygen 1.10.0.
The text was updated successfully, but these errors were encountered: