Skip to content

Commit

Permalink
Updates to documentation templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Nov 17, 2020
1 parent ae4c471 commit f22cccd
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 103 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@
*.egg-info/

# Sphinx
_build
docs/_build/
docs/_autosummary/
33 changes: 33 additions & 0 deletions docs/_templates/class_custom.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ name | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ fullname }}
:members:
:show-inheritance:
:inherited-members:
:undoc-members:
:member-order: groupwise

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

32 changes: 0 additions & 32 deletions docs/_templates/custom-class-template.rst

This file was deleted.

66 changes: 0 additions & 66 deletions docs/_templates/custom-module-template.rst

This file was deleted.

5 changes: 5 additions & 0 deletions docs/_templates/function_custom.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ name | escape | underline}}

.. currentmodule:: {{ module }}

.. autofunction:: {{ fullname }}
69 changes: 69 additions & 0 deletions docs/_templates/module_custom.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{ name | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:template: function_custom.rst
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: class_custom.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: module_custom.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}


14 changes: 10 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
# 'sphinx_autodoc_typehints',
'sphinx_autodoc_typehints',
]
autosummary_generate = True # Turn on sphinx.ext.autosummary

# autodoc_default_options = ['members']
autosummary_imported_members = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -50,7 +50,13 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = 'bootstrap-astropy'
html_theme_options = {
'logotext1': 'kg', # white, semi-bold
'logotext2': 'py', # blue, light
'logotext3': ':docs', # white, light
'astropy_project_menubar': False
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Kankelborg Group repositories (that generally represent different instruments).

.. autosummary::
:toctree: _autosummary
:template: module_custom.rst
:recursive:

kgpy
Expand Down

0 comments on commit f22cccd

Please sign in to comment.