This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak docs config from Qiskit/qiskit#6855
- Loading branch information
Showing
3 changed files
with
97 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{# | ||
The general principle of this is that we manually document attributes here in | ||
the same file, but give all methods their own page. By default, we document | ||
all methods, including those defined by parent classes. | ||
-#} | ||
|
||
{{ objname | escape | underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
{#- | ||
Avoid having autodoc populate the class with the members we're about to | ||
summarize to avoid duplication. | ||
#} | ||
:no-members: | ||
:show-inheritance: | ||
{# | ||
Methods all get their own separate page, with their names and the first lines | ||
of their docstrings tabulated. The documentation from `__init__` is | ||
automatically included in the standard class documentation, so we don't want | ||
to repeat it. | ||
-#} | ||
{% block methods_summary %}{% set wanted_methods = (methods | reject('==', '__init__') | list) %}{% if wanted_methods %} | ||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
:toctree: ../stubs/ | ||
{% for item in wanted_methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock %} | ||
|
||
{% block attributes_summary %}{% if attributes %} | ||
.. rubric:: Attributes | ||
{# Attributes should all be summarized directly on the same page. -#} | ||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock -%} |
38 changes: 38 additions & 0 deletions
38
docs/_templates/autosummary/class_no_inherited_members.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{# | ||
This is very similar to the default class template, except this one is used | ||
when we don't want to generate any inherited methods. | ||
-#} | ||
|
||
{{ objname | escape | underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
{#- | ||
Avoid having autodoc populate the class with the members we're about to | ||
summarize to avoid duplication. | ||
#} | ||
:no-members: | ||
:show-inheritance: | ||
{# | ||
Methods all get their own separate page, with their names and the first lines | ||
of their docstrings tabulated. | ||
-#} | ||
{% block methods_summary %}{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}{% if wanted_methods %} | ||
.. rubric:: Methods Defined Here | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
:toctree: ../stubs/ | ||
{% for item in wanted_methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock %} | ||
|
||
{% block attributes_summary %}{% if attributes %} | ||
.. rubric:: Attributes | ||
{# Attributes should all be summarized directly on the same page. -#} | ||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters