diff options
author | jfbu <jfbu@free.fr> | 2021-02-04 18:31:45 +0300 |
---|---|---|
committer | jfbu <jfbu@free.fr> | 2021-02-04 18:31:45 +0300 |
commit | 87fa272763f9d19b5fa51038b2b5e4a58773de21 (patch) | |
tree | a7c32ac0bb0c7c415f8c1c6573d866d324acc2b6 /sphinx/ext | |
parent | 307a0e580fffa92ece92f08dc1be3a7db4a90dd1 (diff) | |
parent | ec5b169312399b700298ab95d860a1e217872832 (diff) |
Merge branch '3.x' into merge_3.x_into_master
Resolved Conflicts:
sphinx/texinputs/sphinxpackagefootnote.sty
Diffstat (limited to 'sphinx/ext')
-rw-r--r-- | sphinx/ext/autodoc/directive.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py index 72407de35..69177f271 100644 --- a/sphinx/ext/autodoc/directive.py +++ b/sphinx/ext/autodoc/directive.py @@ -32,6 +32,9 @@ AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members', 'ignore-module-all', 'exclude-members', 'member-order', 'imported-members'] +AUTODOC_EXTENDABLE_OPTIONS = ['members', 'private-members', 'special-members', + 'exclude-members'] + class DummyOptionSpec(dict): """An option_spec allows any options.""" @@ -76,7 +79,19 @@ 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: - options[name] = config.autodoc_default_options[name] + if name in options and isinstance(config.autodoc_default_options[name], str): + # 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] + + elif options.get(name) is not None: + # remove '+' from option argument if there's nothing to merge it with + options[name] = options[name].lstrip('+') return Options(assemble_option_dict(options.items(), documenter.option_spec)) |