Skip to content

Commit

Permalink
Add synopsis and parameter cross-link support to Python domain
Browse files Browse the repository at this point in the history
This adds a new `py:param` Sphinx role that can be used (in addition
to the `py:obj` role) to reference parameters.
  • Loading branch information
jbms committed Apr 30, 2022
1 parent 3e684dc commit 506c988
Show file tree
Hide file tree
Showing 4 changed files with 522 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The following options can be customized for each object type using

- ``std`` (including object types added using :py:obj:`sphinx.application.Sphinx.add_object_type`)
- ``c`` and ``cpp``
- ``py``

.. admonition:: Example
:class: example
Expand All @@ -88,6 +89,7 @@ The following options can be customized for each object type using

- ``std`` (including object types added using :py:obj:`sphinx.application.Sphinx.add_object_type`)
- ``c`` and ``cpp``
- ``py``

.. admonition:: Example
:class: example
Expand Down
7 changes: 3 additions & 4 deletions docs/cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ C++ domain customization

.. confval:: cpp_qualify_parameter_ids

:python:`bool` specifying whether function, template, and macro parameters
should be assigned fully-qualified ids (for cross-linking purposes) of the
form ``<parent-id>-p-<param-name>`` based on the id of the parent
declaration. Defaults to :python:`True`.
Specifies whether function, template, and macro parameters should be assigned
fully-qualified ids (for cross-linking purposes) of the form
``<parent-id>-p-<param-name>`` based on the id of the parent declaration.

If set to :python:`False`, instead the shorter unqualified id
``p-<param-name>`` is used. This option should only be set to
Expand Down
10 changes: 10 additions & 0 deletions docs/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,13 @@ Python domain customization

The concise syntax is non-standard and not accepted by Python type
checkers.

.. confval:: python_qualify_parameter_ids

Specifies whether function parameters should be assigned fully-qualified ids
(for cross-linking purposes) of the form ``<parent-id>.<param-name>`` based
on the id of the parent declaration. Defaults to :python:`True`.

If set to :python:`False`, instead the shorter unqualified id
``p-<param-name>`` is used. This option should only be set to
:python:`False` if each Python declaration is on a separate page.
Loading

0 comments on commit 506c988

Please sign in to comment.