Skip to content

Commit d20e495

Browse files
authored
Merge pull request #118 from dihm/rtd_fixes
Sphinx autosummary fixes
2 parents afae8e0 + 1a54ed8 commit d20e495

File tree

4 files changed

+41
-29
lines changed

4 files changed

+41
-29
lines changed
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
{{ fullname | escape | underline}}
22

3-
{% block submodules %}
4-
{% if modules %}
5-
.. rubric:: {{ _('Sub-Modules') }}
6-
.. autosummary::
7-
:toctree:
8-
:template: autosummary-module.rst
9-
:recursive:
10-
11-
{% for item in modules %}
12-
{{ item }}
13-
{%- endfor %}
14-
{% endif %}
15-
{% endblock %}
16-
173
.. automodule:: {{ fullname }}
184

195
{% block attributes %}
20-
{% if attributes %}
6+
{%- if attributes %}
217
.. rubric:: {{ _('Module Attributes') }}
228

239
.. autosummary::
@@ -26,10 +12,10 @@
2612
{{ item }}
2713
{%- endfor %}
2814
{% endif %}
29-
{% endblock %}
15+
{%- endblock %}
3016

31-
{% block functions %}
32-
{% if functions %}
17+
{%- block functions %}
18+
{%- if functions %}
3319
.. rubric:: {{ _('Functions') }}
3420

3521
.. autosummary::
@@ -38,10 +24,10 @@
3824
{{ item }}
3925
{%- endfor %}
4026
{% endif %}
41-
{% endblock %}
27+
{%- endblock %}
4228

43-
{% block classes %}
44-
{% if classes %}
29+
{%- block classes %}
30+
{%- if classes %}
4531
.. rubric:: {{ _('Classes') }}
4632

4733
.. autosummary::
@@ -51,10 +37,10 @@
5137
{{ item }}
5238
{%- endfor %}
5339
{% endif %}
54-
{% endblock %}
40+
{%- endblock %}
5541

56-
{% block exceptions %}
57-
{% if exceptions %}
42+
{%- block exceptions %}
43+
{%- if exceptions %}
5844
.. rubric:: {{ _('Exceptions') }}
5945

6046
.. autosummary::
@@ -63,4 +49,18 @@
6349
{{ item }}
6450
{%- endfor %}
6551
{% endif %}
66-
{% endblock %}
52+
{%- endblock %}
53+
54+
{%- block modules %}
55+
{%- if modules %}
56+
.. rubric:: Modules
57+
58+
.. autosummary::
59+
:toctree:
60+
:template: autosummary-module.rst
61+
:recursive:
62+
{% for item in modules %}
63+
{{ item }}
64+
{%- endfor %}
65+
{% endif %}
66+
{%- endblock %}

docs/source/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ API Reference
44

55
.. autosummary::
66
:toctree: _autosummary
7+
:template: autosummary-module.rst
78
:recursive:
89

910
labscript_utils

docs/source/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,29 @@
163163
labscript_suite_doc_version = 'latest'
164164

165165
# add intersphinx references for each component
166+
labscript_intersphinx_mapping = {}
166167
for ls_prog in labscript_suite_programs:
167-
intersphinx_mapping[ls_prog] = (
168+
val = (
168169
'https://docs.labscriptsuite.org/projects/{}/en/{}/'.format(
169170
ls_prog, labscript_suite_doc_version
170171
),
171172
None,
172173
)
174+
labscript_intersphinx_mapping[ls_prog] = val
175+
if ls_prog != project:
176+
# don't add intersphinx for current project
177+
# if internal links break, they can silently be filled by links to existing online docs
178+
# this is confusing and difficult to detect
179+
intersphinx_mapping[ls_prog] = val
173180

174181
# add intersphinx reference for the metapackage
175182
if project != "the labscript suite":
176-
intersphinx_mapping['labscript-suite'] = (
183+
val = (
177184
'https://docs.labscriptsuite.org/en/{}/'.format(labscript_suite_doc_version),
178185
None,
179186
)
187+
intersphinx_mapping['labscript-suite'] = val
188+
labscript_intersphinx_mapping['labscript-suite'] = val
180189

181190
# Make `some code` equivalent to :code:`some code`
182191
default_role = 'code'
@@ -226,7 +235,7 @@ def setup(app):
226235
with open(Path(__file__).resolve().parent / 'components.rst', 'w') as f:
227236
f.write(
228237
template.render(
229-
intersphinx_mapping=intersphinx_mapping,
238+
intersphinx_mapping=labscript_intersphinx_mapping,
230239
programs=labscript_suite_programs,
231240
current_project=project,
232241
img_path=img_path

docs/source/labconfig.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ The name of this file must be the host computer's system name.
77
So if my system's name was `heisenberg`, the labconfig file name would be `heisenberg.ini`.
88
This file should be located in the `labscript-suite` directory in the user space, in the `labconfig` subdirectory.
99

10-
When :doc:`installing the **labscript-suite** for the first time <labscript-suite:installation/index>`, running the `labscript-profile-create` command will automatically generate the `labscript-suite` user space directory in the correct place and generate a `labconfig.ini` file for use on your system.
10+
When :doc:`installing the **labscript-suite** for the first time <labscript-suite:installation/index>`,
11+
running the `labscript-profile-create` command will automatically generate the `labscript-suite` user space directory in the correct place
12+
and generate a `labconfig.ini` file for use on your system.
1113
By editing the `ini` file named after your system, you can update the configuration settings of your **labscript-suite** installation.
1214

1315
The Default *labconfig.ini*

0 commit comments

Comments
 (0)