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

georg.brandl python-checkins at python.org
Tue Jul 8 16:45:44 CEST 2008


Author: georg.brandl
Date: Tue Jul  8 16:45:44 2008
New Revision: 64794

Log:
automodule now supports module options.


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	Tue Jul  8 16:45:44 2008
@@ -12,6 +12,9 @@
 * `JSONHTMLBuilder` was added that similarily to `PickleHTMLBuilder`
   dumps the generated HTML into JSON files for further processing.
 
+* The `automodule` directive now supports the ``synopsis``,
+  ``deprecated`` and ``platform`` options.
+
 
 Release 0.4.1 (Jul 5, 2008)
 ===========================

Modified: doctools/trunk/doc/ext/autodoc.rst
==============================================================================
--- doctools/trunk/doc/ext/autodoc.rst	(original)
+++ doctools/trunk/doc/ext/autodoc.rst	Tue Jul  8 16:45:44 2008
@@ -121,6 +121,11 @@
 
      .. versionadded:: 0.4
 
+   * :dir:`automodule` also recognizes the ``synopsis``, ``platform`` and
+     ``deprecated`` options that the standard :dir:`module` directive supports.
+
+     .. versionadded:: 0.5
+
    .. 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	Tue Jul  8 16:45:44 2008
@@ -383,7 +383,15 @@
                 and 'staticmethod' or what
     result.append(indent + u'.. %s:: %s%s' % (directive, name_in_directive, args),
                   '<autodoc>')
-    if what != 'module':
+    if what == 'module':
+        # Add some module-specific options
+        if options.synopsis:
+            result.append(indent + u'   :synopsis: ' + options.synopsis, '<autodoc>')
+        if options.platform:
+            result.append(indent + u'   :platform: ' + options.platform, '<autodoc>')
+        if options.deprecated:
+            result.append(indent + u'   :deprecated:', '<autodoc>')
+    else:
         # 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>')
@@ -500,6 +508,9 @@
     genopt.undoc_members = 'undoc-members' in options
     genopt.show_inheritance = 'show-inheritance' in options
     genopt.noindex = 'noindex' in options
+    genopt.synopsis = options.get('synopsis', '')
+    genopt.platform = options.get('platform', '')
+    genopt.deprecated = 'deprecated' in options
 
     filename_set = set()
     warnings, result = generate_rst(what, name, members, genopt, content, state.document,
@@ -549,7 +560,8 @@
 
 def setup(app):
     mod_options = {'members': members_option, 'undoc-members': directives.flag,
-                   'noindex': directives.flag}
+                   'noindex': directives.flag, 'synopsis': lambda x: x,
+                   'platform': lambda x: x, 'deprecated': directives.flag}
     cls_options = {'members': members_option, 'undoc-members': directives.flag,
                    'noindex': directives.flag, 'inherited-members': directives.flag,
                    'show-inheritance': directives.flag}


More information about the Python-checkins mailing list