autodoc2.render.rst_#

Renderer for reStructuredText.

Module Contents#

Classes#

RstRenderer

Render the documentation as reStructuredText.

Data#

API#

autodoc2.render.rst_._RE_DELIMS = 'compile(...)'#
class autodoc2.render.rst_.RstRenderer(db: autodoc2.db.Database, config: autodoc2.config.Config, *, warn: Callable[[str, autodoc2.utils.WarningSubtypes], None] | None = None, all_resolver: autodoc2.resolve_all.AllResolver | None = None, standalone: bool = True)[source]#

Bases: autodoc2.render.base.RendererBase

Render the documentation as reStructuredText.

Initialization

Initialise the renderer.

Parameters:
  • db – The database to obtain objects from.

  • config – The configuration.

  • warn – The function to use to log warnings.

  • all_resolver – The resolver to use, for following __all__ children.

  • standalone – If True, this renderer is being used to create a standalone document

EXTENSION = '.rst'#
render_item(full_name: str) Iterable[str][source]#
generate_summary(objects: list[autodoc2.utils.ItemData], alias: dict[str, str] | None = None) Iterable[str][source]#
render_package(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a package.

render_module(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a module.

render_function(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a function.

render_exception(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for an exception.

render_class(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a class.

render_property(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a property.

render_method(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a method.

render_attribute(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for an attribute.

render_data(item: autodoc2.utils.ItemData) Iterable[str][source]#

Create the content for a data item.

_reformat_cls_base_rst(value: str) str[source]#

Reformat the base of a class for RST.

Base annotations can come in the form:

A[B, C, D]

which we want to reformat as:

:py:obj:`A`\ [\ :py:obj:`B`\ , :py:obj:`C`\ , :py:obj:`D`\ ]

The backslash escapes are needed because of: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#character-level-inline-markup-1