[Python-checkins] r64457 - in doctools/trunk: CHANGES doc/ext/autodoc.rst sphinx/ext/autodoc.py

georg.brandl python-checkins at python.org
Sun Jun 22 19:58:05 CEST 2008


Author: georg.brandl
Date: Sun Jun 22 19:58:05 2008
New Revision: 64457

Log:
Support :noindex: in autodoc directives.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/doc/ext/autodoc.rst
   doctools/trunk/sphinx/ext/autodoc.py

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sun Jun 22 19:58:05 2008
@@ -72,6 +72,8 @@
   - The `autodoc` extension now offers a ``show-inheritance`` option
     for autoclass that inserts a list of bases after the signature.
 
+  - The autodoc directives now support the ``noindex`` flag option.
+
 
 Bugs fixed
 ----------

Modified: doctools/trunk/doc/ext/autodoc.rst
==============================================================================
--- doctools/trunk/doc/ext/autodoc.rst	(original)
+++ doctools/trunk/doc/ext/autodoc.rst	Sun Jun 22 19:58:05 2008
@@ -114,6 +114,13 @@
 
      .. versionadded:: 0.4
 
+   * All autodoc directives support the ``noindex`` flag option that has the
+     same effect as for standard :dir:`function` etc. directives: no index
+     entries are generated for the documented object (and all autodocumented
+     members).
+
+     .. versionadded:: 0.4
+
    .. note::
 
       In an :dir:`automodule` directive with the ``members`` option set, only

Modified: doctools/trunk/sphinx/ext/autodoc.py
==============================================================================
--- doctools/trunk/sphinx/ext/autodoc.py	(original)
+++ doctools/trunk/sphinx/ext/autodoc.py	Sun Jun 22 19:58:05 2008
@@ -314,6 +314,8 @@
         # Be explicit about the module, this is necessary since .. class:: doesn't
         # support a prepended module name
         result.append(indent + u'   :module: %s' % mod, '<autodoc>')
+    if options.noindex:
+        result.append(indent + u'   :noindex:', '<autodoc>')
     result.append(u'', '<autodoc>')
 
     if options.show_inheritance and what in ('class', 'exception'):
@@ -424,6 +426,7 @@
         members = ['__all__']
     genopt.undoc = 'undoc-members' in options
     genopt.show_inheritance = 'show-inheritance' in options
+    genopt.noindex = 'noindex' in options
 
     filename_set = set()
     warnings, result = generate_rst(what, name, members, genopt, content, state.document,
@@ -469,9 +472,10 @@
 
 
 def setup(app):
-    mod_options = {'members': members_directive, 'undoc-members': directives.flag}
+    mod_options = {'members': members_directive, 'undoc-members': directives.flag,
+                   'noindex': directives.flag}
     cls_options = {'members': members_directive, 'undoc-members': directives.flag,
-                   'inherited-members': directives.flag,
+                   'noindex': directives.flag, 'inherited-members': directives.flag,
                    'show-inheritance': directives.flag}
     app.add_directive('automodule', auto_directive_withmembers,
                       1, (1, 0, 1), **mod_options)
@@ -479,8 +483,11 @@
                       1, (1, 0, 1), **cls_options)
     app.add_directive('autoexception', auto_directive_withmembers,
                       1, (1, 0, 1), **cls_options)
-    app.add_directive('autofunction', auto_directive, 1, (1, 0, 1))
-    app.add_directive('automethod', auto_directive, 1, (1, 0, 1))
-    app.add_directive('autoattribute', auto_directive, 1, (1, 0, 1))
+    app.add_directive('autofunction', auto_directive, 1, (1, 0, 1)
+                      noindex=directives.flag)
+    app.add_directive('automethod', auto_directive, 1, (1, 0, 1),
+                      noindex=directives.flag)
+    app.add_directive('autoattribute', auto_directive, 1, (1, 0, 1),
+                      noindex=directives.flag)
     app.add_config_value('automodule_skip_lines', 0, True)
     app.add_config_value('autoclass_content', 'class', True)


More information about the Python-checkins mailing list