Skip to content

Commit

Permalink
docs: sphinx-extensions: make rstFlatTable work with docutils 0.13
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mitya57 authored and Jonathan Corbet committed Dec 18, 2016
1 parent 3fa71d0 commit 217e2bf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Documentation/sphinx/rstFlatTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ def __init__(self, directive):
def buildTableNode(self):

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

Expand Down

0 comments on commit 217e2bf

Please sign in to comment.