tighten up the tables within each deliverable section

Change-Id: I4ef0dfda44a65943ef27836a3d7708e8dcb45540
This commit is contained in:
Doug Hellmann
2015-08-20 11:54:02 -07:00
parent 7670133195
commit 85702075de

View File

@@ -24,7 +24,7 @@ from sphinx.util.nodes import nested_parse_with_titles
import yaml import yaml
def _list_table(add, headers, data, title=''): def _list_table(add, headers, data, title='', columns=None):
"""Build a list-table directive. """Build a list-table directive.
:param add: Function to add one row to output. :param add: Function to add one row to output.
@@ -33,6 +33,8 @@ def _list_table(add, headers, data, title=''):
""" """
add('.. list-table:: %s' % title) add('.. list-table:: %s' % title)
add(' :header-rows: 1') add(' :header-rows: 1')
if columns:
add(' :widths: %s' % (','.join(str(c) for c in columns)))
add('') add('')
add(' - * %s' % headers[0]) add(' - * %s' % headers[0])
for h in headers[1:]: for h in headers[1:]:
@@ -88,7 +90,7 @@ class DeliverableDirective(rst.Directive):
lambda t: result.append(t, source_name), lambda t: result.append(t, source_name),
['Deliverable', 'Version'], ['Deliverable', 'Version'],
most_recent, most_recent,
title='Most Recent', title='Most Recent Releases',
) )
# Show the detailed history of the deliverables within the series. # Show the detailed history of the deliverables within the series.
@@ -115,14 +117,16 @@ class DeliverableDirective(rst.Directive):
_title(deliverable_name, '=') _title(deliverable_name, '=')
for release in reversed(deliverable_info.get('releases', [])): app.info('[deliverables] %s' % deliverable_name)
app.info('[deliverables] %s release %s' %
(deliverable_name, release['version'])) _list_table(
_rubric(release['version']) _add,
_list_table( ['Version', 'Repo', 'SHA'],
_add, ['Repo', 'SHA'], ((r['version'], p['repo'], p['hash'])
((p['repo'], p['hash']) for p in release.get('projects', [])) for r in reversed(deliverable_info.get('releases', []))
) for p in r.get('projects', [])),
columns=[10, 40, 50],
)
node = nodes.section() node = nodes.section()
node.document = self.state.document node.document = self.state.document