mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
automodule now supports module options.
This commit is contained in:
parent
d2909ee303
commit
aa74c0b799
3
CHANGES
3
CHANGES
@ -12,6 +12,9 @@ New features added
|
|||||||
* `JSONHTMLBuilder` was added that similarily to `PickleHTMLBuilder`
|
* `JSONHTMLBuilder` was added that similarily to `PickleHTMLBuilder`
|
||||||
dumps the generated HTML into JSON files for further processing.
|
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)
|
Release 0.4.1 (Jul 5, 2008)
|
||||||
===========================
|
===========================
|
||||||
|
@ -121,6 +121,11 @@ directive.
|
|||||||
|
|
||||||
.. versionadded:: 0.4
|
.. versionadded:: 0.4
|
||||||
|
|
||||||
|
* :dir:`automodule` also recognizes the ``synopsis``, ``platform`` and
|
||||||
|
``deprecated`` options that the standard :dir:`module` directive supports.
|
||||||
|
|
||||||
|
.. versionadded:: 0.5
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
In an :dir:`automodule` directive with the ``members`` option set, only
|
In an :dir:`automodule` directive with the ``members`` option set, only
|
||||||
|
@ -383,7 +383,15 @@ def generate_rst(what, name, members, options, add_content, document, lineno,
|
|||||||
and 'staticmethod' or what
|
and 'staticmethod' or what
|
||||||
result.append(indent + u'.. %s:: %s%s' % (directive, name_in_directive, args),
|
result.append(indent + u'.. %s:: %s%s' % (directive, name_in_directive, args),
|
||||||
'<autodoc>')
|
'<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
|
# Be explicit about the module, this is necessary since .. class:: doesn't
|
||||||
# support a prepended module name
|
# support a prepended module name
|
||||||
result.append(indent + u' :module: %s' % mod, '<autodoc>')
|
result.append(indent + u' :module: %s' % mod, '<autodoc>')
|
||||||
@ -500,6 +508,9 @@ def _auto_directive(dirname, arguments, options, content, lineno,
|
|||||||
genopt.undoc_members = 'undoc-members' in options
|
genopt.undoc_members = 'undoc-members' in options
|
||||||
genopt.show_inheritance = 'show-inheritance' in options
|
genopt.show_inheritance = 'show-inheritance' in options
|
||||||
genopt.noindex = 'noindex' 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()
|
filename_set = set()
|
||||||
warnings, result = generate_rst(what, name, members, genopt, content, state.document,
|
warnings, result = generate_rst(what, name, members, genopt, content, state.document,
|
||||||
@ -549,7 +560,8 @@ def members_option(arg):
|
|||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
mod_options = {'members': members_option, 'undoc-members': directives.flag,
|
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,
|
cls_options = {'members': members_option, 'undoc-members': directives.flag,
|
||||||
'noindex': directives.flag, 'inherited-members': directives.flag,
|
'noindex': directives.flag, 'inherited-members': directives.flag,
|
||||||
'show-inheritance': directives.flag}
|
'show-inheritance': directives.flag}
|
||||||
|
Loading…
Reference in New Issue
Block a user