diff options
author | Stephen Finucane <sfinucan@redhat.com> | 2018-07-18 09:58:10 +0100 |
---|---|---|
committer | Stephen Finucane <sfinucan@redhat.com> | 2018-08-21 14:50:51 +0100 |
commit | 43c6ba77c93af6b07da3f4c06c05ce414360d5e9 (patch) | |
tree | 392bf51d81b1f435105003647c93c9a9fccf522a | |
parent | a31cce7fde817a0364d8b9686017b6b7fca142d1 (diff) | |
download | oslo-config-43c6ba77c93af6b07da3f4c06c05ce414360d5e9.tar.gz |
sphinxext: Handle multi-line group descriptions
While multi-line help texts for opts were already handled properly, the
same was not true of groups. Close this gap, allowing us to resolve the
FIXME in the process.
Change-Id: Ic564dbff983205134386ba5b7047d6d811c60ef1
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
-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 |