mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
redundant '+' has no effect
This commit is contained in:
parent
381e30c23b
commit
ac5079ed85
@ -93,9 +93,14 @@ def process_documenter_options(documenter: "Type[Documenter]", config: Config, o
|
||||
if options[name] is not None and options[name].startswith('+'):
|
||||
options[name] = ','.join([config.autodoc_default_options[name],
|
||||
options[name][1:]])
|
||||
print(options[name])
|
||||
else:
|
||||
options[name] = config.autodoc_default_options[name]
|
||||
|
||||
elif isinstance(options.get(name), str) and options[name].startswith('+'):
|
||||
# remove '+' from option argument if there's nothing to merge it with
|
||||
options[name] = options[name][1:]
|
||||
|
||||
return Options(assemble_option_dict(options.items(), documenter.option_spec))
|
||||
|
||||
|
||||
|
@ -627,6 +627,15 @@ def test_autodoc_exclude_members(app):
|
||||
'.. py:class:: Base()',
|
||||
]
|
||||
|
||||
# + has no effect when autodoc_default_options are not present
|
||||
options = {"members": None,
|
||||
"exclude-members": "+inheritedmeth,inheritedstaticmeth"}
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:method:: Base.inheritedclassmeth()'
|
||||
]
|
||||
|
||||
# exclude-members overrides autodoc_default_options
|
||||
options = {"members": None,
|
||||
"exclude-members": "inheritedmeth"}
|
||||
|
Loading…
Reference in New Issue
Block a user