diff options
author | Zuul <zuul@review.openstack.org> | 2018-10-08 17:26:39 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-10-08 17:26:39 +0000 |
commit | ae7dbd939f76d84c0e4ee479f1c82aa4925d6e95 (patch) | |
tree | 40694ec95dbd69907c05710abc2dad660957c549 | |
parent | 03e8202b90535f95d9dd3f58ae96048c2a1ab0c4 (diff) | |
parent | 43c6ba77c93af6b07da3f4c06c05ce414360d5e9 (diff) | |
download | oslo-config-ae7dbd939f76d84c0e4ee479f1c82aa4925d6e95.tar.gz |
Merge "sphinxext: Handle multi-line group descriptions"6.6.0
-rw-r--r-- | oslo_config/sphinxext.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/oslo_config/sphinxext.py b/oslo_config/sphinxext.py index d9f256a..74a15ef 100644 --- a/oslo_config/sphinxext.py +++ b/oslo_config/sphinxext.py @@ -202,7 +202,8 @@ def _format_group(namespace, group_name, group_obj): yield '' if group_obj and group_obj.help: - yield _indent(group_obj.help.rstrip()) + for line in group_obj.help.strip().splitlines(): + yield _indent(line.rstrip()) yield '' @@ -304,19 +305,10 @@ class ShowOptionsDirective(rst.Directive): result = ViewList() source_name = self.state.document.current_source - offset = 0 for count, line in enumerate(_format_option_help( namespaces, split_namespaces)): - # FIXME(stephenfin): Some lines emitted are actually multiple - # lines. This throws off our counter, which is rather annoying. - # We handle this here but we should really handle it higher up. - parts = line.split('\n') - if len(parts) > 1: - offset += len(parts) - 1 - - for part in parts: - result.append(part, source_name, count + offset) - LOG.debug(' '.join(['%5d' % (count + offset), part])) + result.append(line, source_name, count) + LOG.debug(' '.join(['%5d' % (count), line])) node = nodes.section() node.document = self.state.document |