sphinxext: Don't sometimes emit trailing newlines
Change-Id: I28f82538ef9098c2e5fd2e288302c654422a55e6
This commit is contained in:
parent
bc9b7f5d2f
commit
26545b7a09
@ -49,7 +49,6 @@ def _list_table(headers, data, title='', columns=None):
|
||||
yield ' - * %s' % row[0]
|
||||
for r in row[1:]:
|
||||
yield ' * %s' % r
|
||||
yield ''
|
||||
|
||||
|
||||
def _indent(text, n=2):
|
||||
@ -152,7 +151,6 @@ def _format_group(app, namespace, group_name, group_obj, opt_list):
|
||||
'by the majority of users, and might have a significant', 6)
|
||||
yield _indent(
|
||||
'effect on stability and/or performance.', 6)
|
||||
yield ''
|
||||
|
||||
try:
|
||||
help_text = opt.help % {'default': 'the value above'}
|
||||
@ -162,22 +160,23 @@ def _format_group(app, namespace, group_name, group_obj, opt_list):
|
||||
# invalid formatting characters
|
||||
help_text = opt.help
|
||||
if help_text:
|
||||
yield _indent(help_text)
|
||||
yield ''
|
||||
yield _indent(help_text)
|
||||
|
||||
# We don't bother outputting this if not using new-style choices with
|
||||
# inline descriptions
|
||||
if getattr(opt.type, 'choices', None) and not all(
|
||||
x is None for x in opt.type.choices.values()):
|
||||
yield _indent('.. rubric:: Possible values')
|
||||
yield ''
|
||||
yield _indent('.. rubric:: Possible values')
|
||||
for choice in opt.type.choices:
|
||||
yield ''
|
||||
yield _indent(_get_choice_text(choice))
|
||||
yield _indent(_indent(
|
||||
opt.type.choices[choice] or '<No description provided>'))
|
||||
yield ''
|
||||
|
||||
if opt.deprecated_opts:
|
||||
yield ''
|
||||
for line in _list_table(
|
||||
['Group', 'Name'],
|
||||
((d.group or group_name,
|
||||
@ -185,7 +184,9 @@ def _format_group(app, namespace, group_name, group_obj, opt_list):
|
||||
for d in opt.deprecated_opts),
|
||||
title='Deprecated Variations'):
|
||||
yield _indent(line)
|
||||
|
||||
if opt.deprecated_for_removal:
|
||||
yield ''
|
||||
yield _indent('.. warning::')
|
||||
if opt.deprecated_since:
|
||||
yield _indent(' This option is deprecated for removal '
|
||||
@ -194,10 +195,9 @@ def _format_group(app, namespace, group_name, group_obj, opt_list):
|
||||
yield _indent(' This option is deprecated for removal.')
|
||||
yield _indent(' Its value may be silently ignored ')
|
||||
yield _indent(' in the future.')
|
||||
yield ''
|
||||
if opt.deprecated_reason:
|
||||
yield ''
|
||||
yield _indent(' :Reason: ' + opt.deprecated_reason)
|
||||
yield ''
|
||||
|
||||
yield ''
|
||||
|
||||
|
@ -42,7 +42,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Default: ``<None>``
|
||||
|
||||
this appears in the default group
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_default_value(self):
|
||||
@ -66,7 +65,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Default: ``this is the default``
|
||||
|
||||
this appears in the default group
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_min(self):
|
||||
@ -88,7 +86,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
:Minimum Value: 1
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_min_0(self):
|
||||
@ -110,7 +107,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
:Minimum Value: 0
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_max(self):
|
||||
@ -132,7 +128,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
:Maximum Value: 1
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_max_0(self):
|
||||
@ -154,7 +149,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
:Maximum Value: 0
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_choices(self):
|
||||
@ -176,7 +170,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: string
|
||||
:Default: ``<None>``
|
||||
:Valid Values: a, b, c, <None>, ''
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_with_choices_with_descriptions(self):
|
||||
@ -221,7 +214,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
|
||||
''
|
||||
<No description provided>
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_group_obj_without_help(self):
|
||||
@ -240,7 +232,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
|
||||
:Type: string
|
||||
:Default: ``<None>``
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_group_obj_with_help(self):
|
||||
@ -261,7 +252,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
|
||||
:Type: string
|
||||
:Default: ``<None>``
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_deprecated_opts_without_deprecated_group(self):
|
||||
@ -291,7 +281,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
* Name
|
||||
- * DEFAULT
|
||||
* deprecated_name
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_deprecated_opts_with_deprecated_group(self):
|
||||
@ -322,7 +311,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
* Name
|
||||
- * deprecated_group
|
||||
* deprecated_name
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_deprecated_for_removal(self):
|
||||
@ -362,7 +350,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
:Mutable: This option can be changed without restarting.
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_not_mutable(self):
|
||||
@ -383,7 +370,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
|
||||
:Type: integer
|
||||
:Default: ``<None>``
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_advanced(self):
|
||||
@ -407,7 +393,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
:Advanced Option: Intended for advanced users and not used
|
||||
by the majority of users, and might have a significant
|
||||
effect on stability and/or performance.
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
def test_not_advanced(self):
|
||||
@ -428,7 +413,6 @@ class FormatGroupTest(base.BaseTestCase):
|
||||
|
||||
:Type: string
|
||||
:Default: ``<None>``
|
||||
|
||||
''').lstrip(), results)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user