docs: Add module which turns on autodoc for private members with docstrings

This commit is contained in:
Stein Magnus Jodal 2010-02-21 23:31:58 +01:00
parent c96d9d9108
commit b67a58eb6d
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,10 @@
def setup(app):
app.connect('autodoc-skip-member', autodoc_private_members_with_doc)
def autodoc_private_members_with_doc(app, what, name, obj, skip, options):
if not skip:
return skip
if (name.startswith('_') and obj.__doc__ is not None
and not (name.startswith('__') and name.endswith('__'))):
return False
return skip

View File

@ -16,13 +16,14 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.autodoc', 'autodoc_private_members']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -192,3 +193,4 @@ latex_documents = [
# If false, no module index is generated.
#latex_use_modindex = True