diff --git a/CHANGES b/CHANGES index e5131e2db..6409ae2cb 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,9 @@ New features added * `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) =========================== diff --git a/doc/ext/autodoc.rst b/doc/ext/autodoc.rst index 10fc8fbc6..683dad71f 100644 --- a/doc/ext/autodoc.rst +++ b/doc/ext/autodoc.rst @@ -121,6 +121,11 @@ directive. .. 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 diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 13e5400ce..5215a5ab3 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -383,7 +383,15 @@ def generate_rst(what, name, members, options, add_content, document, lineno, and 'staticmethod' or what result.append(indent + u'.. %s:: %s%s' % (directive, name_in_directive, args), '') - if what != 'module': + if what == 'module': + # Add some module-specific options + if options.synopsis: + result.append(indent + u' :synopsis: ' + options.synopsis, '') + if options.platform: + result.append(indent + u' :platform: ' + options.platform, '') + if options.deprecated: + result.append(indent + u' :deprecated:', '') + 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, '') @@ -500,6 +508,9 @@ def _auto_directive(dirname, arguments, options, content, lineno, 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 members_option(arg): 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}