mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
autodoc: allow specifying values to global arguments
Previously, users could specify a *list* of flags in their config files. The flags were directive names that would otherwise be present in the .rst files. However, as a list, it was not possible to specify values to those flags, which *is* possible in .rst files. For example, in .rst you could say :special-members: __init__, __iter__ And this would cause autodoc to generate documents for these methods that it would otherwise ignore. This commit changes the config option to instead accept a dictionary. This is a dictionary whose keys can contain the same flag-names as before, but whose values can contain the arguments as seen in .rst files. The old list is still supported, for backwards compatibility, but the data is transformed into a dictionary when the user's config is loaded.
This commit is contained in:
@@ -353,8 +353,25 @@ There are also new config values that you can set:
|
||||
|
||||
the directive will be interpreted as if only ``:members:`` was given.
|
||||
|
||||
You can also set `autodoc_default_flags` to a dictionary, mapping option
|
||||
names to the values which can used in .rst files. For example::
|
||||
|
||||
autodoc_default_flags = {
|
||||
'members': 'var1, var2',
|
||||
'member-order': 'bysource',
|
||||
'special-members': '__init__',
|
||||
'undoc-members': None,
|
||||
}
|
||||
|
||||
Setting ``None`` is equivalent to giving the option name in the list format
|
||||
(i.e. it means "yes/true/on").
|
||||
|
||||
.. versionadded:: 1.0
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
Specifying in dictionary format added.
|
||||
|
||||
.. confval:: autodoc_docstring_signature
|
||||
|
||||
Functions imported from C modules cannot be introspected, and therefore the
|
||||
|
||||
Reference in New Issue
Block a user