diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-11-13 18:42:21 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-11-13 18:42:21 +0000 |
commit | 9d48a39d23b507e18ca8fa7c5786b5eaea926d0e (patch) | |
tree | 1cba79256dcf51273ad43a88dd8a8393e32e5728 /doc/sphinxext/numpydoc.py | |
parent | 66313a336889e2ff898dad34ffae32d928bb2d5b (diff) | |
download | numpy-9d48a39d23b507e18ca8fa7c5786b5eaea926d0e.tar.gz |
sphinxext: add numpydoc_show_class_members option (from Michael Droettboom)
Diffstat (limited to 'doc/sphinxext/numpydoc.py')
-rw-r--r-- | doc/sphinxext/numpydoc.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/sphinxext/numpydoc.py b/doc/sphinxext/numpydoc.py index 707107daf..06c4523ec 100644 --- a/doc/sphinxext/numpydoc.py +++ b/doc/sphinxext/numpydoc.py @@ -24,14 +24,16 @@ import inspect def mangle_docstrings(app, what, name, obj, options, lines, reference_offset=[0]): + cfg = dict(use_plots=app.config.numpydoc_use_plots, + show_class_members=app.config.numpydoc_show_class_members) + if what == 'module': # Strip top title title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', re.I|re.S) lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n") else: - doc = get_doc_object(obj, what, u"\n".join(lines)) - doc.use_plots = app.config.numpydoc_use_plots + doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg) lines[:] = unicode(doc).split(u"\n") if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \ @@ -91,11 +93,12 @@ def initialize(app): def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ - + app.connect('autodoc-process-docstring', mangle_docstrings) app.connect('builder-inited', initialize) - app.add_config_value('numpydoc_edit_link', None, True) + app.add_config_value('numpydoc_edit_link', None, False) app.add_config_value('numpydoc_use_plots', None, False) + app.add_config_value('numpydoc_show_class_members', True, True) # Extra mangling directives name_type = { @@ -114,7 +117,7 @@ def setup(app, get_doc_object_=get_doc_object): for name, objtype in name_type.items(): app.add_directive('np-' + name, wrap_mangling_directive(name, objtype)) - + #------------------------------------------------------------------------------ # Input-mangling directives #------------------------------------------------------------------------------ |