diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-19 22:58:15 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-19 22:58:15 +0900 |
| commit | aa1bc83c2ac9357b39048b555c3fdb0efff3449c (patch) | |
| tree | c1149670ca18b5f9820505322d5b0a5832395ea4 /sphinx/ext/autosummary | |
| parent | 759a526b12213c59d6ae4c8f66682f4328b764f4 (diff) | |
| parent | 017ef6118b4fe588140266ad6ff2393cbddd9137 (diff) | |
| download | sphinx-git-aa1bc83c2ac9357b39048b555c3fdb0efff3449c.tar.gz | |
Merge branch '4.x'
Diffstat (limited to 'sphinx/ext/autosummary')
| -rw-r--r-- | sphinx/ext/autosummary/__init__.py | 70 | ||||
| -rw-r--r-- | sphinx/ext/autosummary/generate.py | 21 |
2 files changed, 40 insertions, 51 deletions
diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index b2d8db069..c72ee680d 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -1,55 +1,49 @@ -""" - sphinx.ext.autosummary - ~~~~~~~~~~~~~~~~~~~~~~ - - Sphinx extension that adds an autosummary:: directive, which can be - used to generate function/method/attribute/etc. summary lists, similar - to those output eg. by Epydoc and other API doc generation tools. +"""Extension that adds an autosummary:: directive. - An :autolink: role is also provided. +The directive can be used to generate function/method/attribute/etc. summary +lists, similar to those output eg. by Epydoc and other API doc generation tools. - autosummary directive - --------------------- +An :autolink: role is also provided. - The autosummary directive has the form:: +autosummary directive +--------------------- - .. autosummary:: - :nosignatures: - :toctree: generated/ +The autosummary directive has the form:: - module.function_1 - module.function_2 - ... + .. autosummary:: + :nosignatures: + :toctree: generated/ - and it generates an output table (containing signatures, optionally) + module.function_1 + module.function_2 + ... - ======================== ============================================= - module.function_1(args) Summary line from the docstring of function_1 - module.function_2(args) Summary line from the docstring - ... - ======================== ============================================= +and it generates an output table (containing signatures, optionally) - If the :toctree: option is specified, files matching the function names - are inserted to the toctree with the given prefix: + ======================== ============================================= + module.function_1(args) Summary line from the docstring of function_1 + module.function_2(args) Summary line from the docstring + ... + ======================== ============================================= - generated/module.function_1 - generated/module.function_2 - ... +If the :toctree: option is specified, files matching the function names +are inserted to the toctree with the given prefix: - Note: The file names contain the module:: or currentmodule:: prefixes. + generated/module.function_1 + generated/module.function_2 + ... - .. seealso:: autosummary_generate.py +Note: The file names contain the module:: or currentmodule:: prefixes. +.. seealso:: autosummary_generate.py - autolink role - ------------- - The autolink role functions as ``:obj:`` when the name referred can be - resolved to a Python object, and otherwise it becomes simple emphasis. - This can be used as the default role to make links 'smart'. +autolink role +------------- - :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. +The autolink role functions as ``:obj:`` when the name referred can be +resolved to a Python object, and otherwise it becomes simple emphasis. +This can be used as the default role to make links 'smart'. """ import inspect @@ -417,7 +411,7 @@ class Autosummary(SphinxDirective): table_spec['spec'] = r'\X{1}{2}\X{1}{2}' table = autosummary_table('') - real_table = nodes.table('', classes=['longtable']) + real_table = nodes.table('', classes=['autosummary longtable']) table.append(real_table) group = nodes.tgroup('', cols=2) real_table.append(group) diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index a08e45fa6..1866b6c52 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -1,20 +1,15 @@ -""" - sphinx.ext.autosummary.generate - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Usable as a library or script to generate automatic RST source files for - items referred to in autosummary:: directives. +"""Generates reST source files for autosummary. - Each generated RST file contains a single auto*:: directive which - extracts the docstring of the referred item. +Usable as a library or script to generate automatic RST source files for +items referred to in autosummary:: directives. - Example Makefile rule:: +Each generated RST file contains a single auto*:: directive which +extracts the docstring of the referred item. - generate: - sphinx-autogen -o source/generated source/*.rst +Example Makefile rule:: - :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. + generate: + sphinx-autogen -o source/generated source/*.rst """ import argparse |
