Skip to content

Commit 0f3e187

Browse files
authored
[DOC] Add minigalleries to API reference pages (#991)
* add minigalleries to API reference pages * update templates * whatsnew
1 parent 010a2ad commit 0f3e187

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
7+
{% block methods %}
8+
.. automethod:: __init__
9+
10+
{% if methods %}
11+
.. rubric:: Methods
12+
13+
.. autosummary::
14+
{% for item in methods %}
15+
~{{ name }}.{{ item }}
16+
{%- endfor %}
17+
{% endif %}
18+
{% endblock %}
19+
20+
{% block attributes %}
21+
{% if attributes %}
22+
.. rubric:: Attributes
23+
24+
.. autosummary::
25+
{% for item in attributes %}
26+
~{{ name }}.{{ item }}
27+
{%- endfor %}
28+
{% endif %}
29+
{% endblock %}
30+
31+
{# not sure how to get the minigallery directive to not render empty #}
32+
{# galleries, so just use the old `include` style instead #}
33+
{# .. minigallery:: {{ fullname }} #}
34+
35+
.. include:: gallery_backreferences/{{fullname}}.examples
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ fullname | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autofunction:: {{ fullname }}
6+
7+
{# not sure how to get the minigallery directive to not render empty #}
8+
{# galleries, so just use the old `include` style instead #}
9+
{# .. minigallery:: {{ fullname }} #}
10+
11+
.. include:: gallery_backreferences/{{fullname}}.examples
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ fullname | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. automethod:: {{ fullname }}
6+
7+
{# not sure how to get the minigallery directive to not render empty #}
8+
{# galleries, so just use the old `include` style instead #}
9+
{# .. minigallery:: {{ fullname }} #}
10+
11+
.. include:: gallery_backreferences/{{fullname}}.examples

docs/sphinx/source/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,13 @@ def setup(app):
341341
'gallery_dirs': ['auto_examples'], # location of generated output
342342
# sphinx-gallery only shows plots from plot_*.py files by default:
343343
# 'filename_pattern': '*.py',
344+
345+
# directory where function/class granular galleries are stored
346+
'backreferences_dir': 'generated/gallery_backreferences',
347+
348+
# Modules for which function/class level galleries are created. In
349+
# this case only pvlib, could include others though. must be tuple of str
350+
'doc_module': ('pvlib',),
344351
}
345352
# supress warnings in gallery output
346353
# https://sphinx-gallery.github.io/stable/configuration.html

docs/sphinx/source/whatsnew/v0.8.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Documentation
5454
* Add a transposition gain example to the gallery. (:pull:`979`)
5555
* Add a gallery example of calculating diffuse IAM using
5656
:py:func:`pvlib.iam.marion_diffuse`. (:pull:`984`)
57+
* Add minigalleries to API reference pages. (:pull:`991`)
5758

5859
Requirements
5960
~~~~~~~~~~~~

0 commit comments

Comments
 (0)