[Python-checkins] r64714 - in doctools/branches/0.4.x: CHANGES sphinx/directives/other.py sphinx/ext/autodoc.py

georg.brandl python-checkins at python.org
Fri Jul 4 21:19:03 CEST 2008


Author: georg.brandl
Date: Fri Jul  4 21:19:02 2008
New Revision: 64714

Log:
Allow the usage of :noindex: in "automodule" directives, as
documented.


Modified:
   doctools/branches/0.4.x/CHANGES
   doctools/branches/0.4.x/sphinx/directives/other.py
   doctools/branches/0.4.x/sphinx/ext/autodoc.py

Modified: doctools/branches/0.4.x/CHANGES
==============================================================================
--- doctools/branches/0.4.x/CHANGES	(original)
+++ doctools/branches/0.4.x/CHANGES	Fri Jul  4 21:19:02 2008
@@ -20,6 +20,9 @@
 
 * Fix a crash with nonlocal image URIs.
 
+* Allow the usage of :noindex: in "automodule" directives, as
+  documented.
+
 
 Release 0.4 (Jun 23, 2008)
 ==========================

Modified: doctools/branches/0.4.x/sphinx/directives/other.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/directives/other.py	(original)
+++ doctools/branches/0.4.x/sphinx/directives/other.py	Fri Jul  4 21:19:02 2008
@@ -83,6 +83,7 @@
                      content_offset, block_text, state, state_machine):
     env = state.document.settings.env
     modname = arguments[0].strip()
+    noindex = 'noindex' in options
     env.currmodule = modname
     env.note_module(modname, options.get('synopsis', ''),
                     options.get('platform', ''),
@@ -100,13 +101,15 @@
         node += nodes.Text(options['platform'], options['platform'])
         ret.append(node)
     # the synopsis isn't printed; in fact, it is only used in the modindex currently
-    env.note_index_entry('single', '%s (module)' % modname, 'module-' + modname,
-                         modname)
+    if not noindex:
+        env.note_index_entry('single', '%s (module)' % modname,
+                             'module-' + modname, modname)
     return ret
 
 module_directive.arguments = (1, 0, 0)
 module_directive.options = {'platform': lambda x: x,
                             'synopsis': lambda x: x,
+                            'noindex': directives.flag,
                             'deprecated': directives.flag}
 directives.register_directive('module', module_directive)
 

Modified: doctools/branches/0.4.x/sphinx/ext/autodoc.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/ext/autodoc.py	(original)
+++ doctools/branches/0.4.x/sphinx/ext/autodoc.py	Fri Jul  4 21:19:02 2008
@@ -525,7 +525,10 @@
 def auto_directive(*args, **kwds):
     return _auto_directive(*args, **kwds)
 
-def auto_directive_withmembers(*args, **kwds):
+def automodule_directive(*args, **kwds):
+    return _auto_directive(*args, **kwds)
+
+def autoclass_directive(*args, **kwds):
     return _auto_directive(*args, **kwds)
 
 
@@ -541,11 +544,11 @@
     cls_options = {'members': members_option, 'undoc-members': directives.flag,
                    'noindex': directives.flag, 'inherited-members': directives.flag,
                    'show-inheritance': directives.flag}
-    app.add_directive('automodule', auto_directive_withmembers,
+    app.add_directive('automodule', automodule_directive,
                       1, (1, 0, 1), **mod_options)
-    app.add_directive('autoclass', auto_directive_withmembers,
+    app.add_directive('autoclass', autoclass_directive,
                       1, (1, 0, 1), **cls_options)
-    app.add_directive('autoexception', auto_directive_withmembers,
+    app.add_directive('autoexception', autoclass_directive,
                       1, (1, 0, 1), **cls_options)
     app.add_directive('autofunction', auto_directive, 1, (1, 0, 1),
                       noindex=directives.flag)


More information about the Python-checkins mailing list