diff options
author | Dmitry Shachnev <mitya57@debian.org> | 2016-12-18 13:11:46 +0300 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2016-12-18 13:30:29 -0700 |
commit | 217e2bfab22e740227df09f22165e834cddd8a3b (patch) | |
tree | 01e50c55e7a47e283c1fedc8274f3aa38b4dc8c8 | |
parent | 3fa71d0f58a9b9df84e8e79196f961bcfbf01b2e (diff) | |
download | lwn-217e2bfab22e740227df09f22165e834cddd8a3b.tar.gz lwn-217e2bfab22e740227df09f22165e834cddd8a3b.zip |
docs: sphinx-extensions: make rstFlatTable work with docutils 0.13doc-4.10-3
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 <mitya57@debian.org>
Cc: <stable@vger.kernel.org> # 4.8.x-
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rwxr-xr-x | Documentation/sphinx/rstFlatTable.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/sphinx/rstFlatTable.py b/Documentation/sphinx/rstFlatTable.py index 55f275793028..25feb0d35e7a 100755 --- a/Documentation/sphinx/rstFlatTable.py +++ b/Documentation/sphinx/rstFlatTable.py @@ -157,6 +157,11 @@ class ListTableBuilder(object): 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) |