Skip to content

Commit 217e2bf

Browse files
mitya57Jonathan Corbet
authored andcommitted
docs: sphinx-extensions: make rstFlatTable work with docutils 0.13
In docutils 0.13, the return type of get_column_widths method of the Table directive has changed [1], which breaks our flat-table directive and leads to a TypeError when trying to build the docs [2]. This patch adds support for the new return type, while keeping support for older docutils versions too. [1] https://sourceforge.net/p/docutils/patches/120/ [2] https://sourceforge.net/p/docutils/bugs/303/ Signed-off-by: Dmitry Shachnev <[email protected]> Cc: <[email protected]> # 4.8.x- Signed-off-by: Jonathan Corbet <[email protected]>
1 parent 3fa71d0 commit 217e2bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Documentation/sphinx/rstFlatTable.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ def __init__(self, directive):
157157
def buildTableNode(self):
158158

159159
colwidths = self.directive.get_column_widths(self.max_cols)
160+
if isinstance(colwidths, tuple):
161+
# Since docutils 0.13, get_column_widths returns a (widths,
162+
# colwidths) tuple, where widths is a string (i.e. 'auto').
163+
# See https://sourceforge.net/p/docutils/patches/120/.
164+
colwidths = colwidths[1]
160165
stub_columns = self.directive.options.get('stub-columns', 0)
161166
header_rows = self.directive.options.get('header-rows', 0)
162167

0 commit comments

Comments
 (0)