1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Description: add compatibility with docutils 0.13
In docutils 0.13 (and newer), the get_column_widths method of Table
directive returns a tuple, where the widths array is the second item.
.
Also, get_column_widths now has a “if type(self.widths) == list” check,
so use the list syntax when setting the widths property.
Author: Dmitry Shachnev <mitya57@debian.org>
Forwarded: https://review.openstack.org/412227
Last-Update: 2016-12-19
--- a/os_api_ref/__init__.py
+++ b/os_api_ref/__init__.py
@@ -329,8 +329,13 @@
# TODO(sdague): it would be good to dynamically set column
# widths (or basically make the colwidth thing go away
# entirely)
- self.options['widths'] = (20, 10, 10, 60)
+ self.options['widths'] = [20, 10, 10, 60]
self.col_widths = self.get_column_widths(self.max_cols)
+ if isinstance(self.col_widths, 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/.
+ self.col_widths = self.col_widths[1]
# Actually convert the yaml
title, messages = self.make_title()
# self.app.info("Title %s, messages %s" % (title, messages))
|