Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpbudzyns <pawel.budzynski@cern.ch>2021-01-25 14:54:08 +0300
committerpbudzyns <pawel.budzynski@cern.ch>2021-01-25 14:54:08 +0300
commit0a85b4148e272a5ec91abdb53b1a710891db2899 (patch)
tree41c43fa21a826578a1b7a634962cf9c2b707ec9a /sphinx/ext
parent6f78f0b164f4f44a6dbb6abb50c3dc97d221e761 (diff)
add more extendable options and tests
Diffstat (limited to 'sphinx/ext')
-rw-r--r--sphinx/ext/autodoc/directive.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py
index f2c090503..dfac5e0e6 100644
--- a/sphinx/ext/autodoc/directive.py
+++ b/sphinx/ext/autodoc/directive.py
@@ -37,6 +37,8 @@ AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members',
'ignore-module-all', 'exclude-members', 'member-order',
'imported-members']
+AUTODOC_EXTENDABLE_OPTIONS = ['members', 'special-members', 'exclude-members']
+
class DummyOptionSpec(dict):
"""An option_spec allows any options."""
@@ -84,10 +86,12 @@ def process_documenter_options(documenter: "Type[Documenter]", config: Config, o
else:
negated = options.pop('no-' + name, True) is None
if name in config.autodoc_default_options and not negated:
- if name == "exclude-members":
- if config.autodoc_default_options[name]:
- options[name] = config.autodoc_default_options[name] \
- + options.get(name, '')
+ if name in options:
+ # take value from options if present or extend it with autodoc_default_options if necessary
+ if name in AUTODOC_EXTENDABLE_OPTIONS:
+ if options[name] is not None and options[name].startswith('+'):
+ options[name] = ','.join([config.autodoc_default_options[name],
+ options[name][1:]])
else:
options[name] = config.autodoc_default_options[name]