Skip to content

Commit

Permalink
Add template to make auto-generated module docs a bit less ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Apr 9, 2021
1 parent 70aafb5 commit 3883126
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
8 changes: 8 additions & 0 deletions docs/_templates/module.rst_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{%- if show_headings %}
{{- basename.split('.')[-1] | e | heading }}

{% endif -%}
.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
:{{ option }}:
{%- endfor %}
10 changes: 7 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
templates_path = ['_templates']

# Exclude the generated aiohttp_client_cache.rst, which will just contain top-level __init__ info
exclude_patterns = ['_build', 'modules/aiohttp_client_cache.rst']
exclude_patterns = [
'_build',
'modules/aiohttp_client_cache.rst',
'modules/aiohttp_client_cache.backends.rst',
]

# Sphinx extension modules
extensions = [
Expand Down Expand Up @@ -59,8 +63,8 @@
copybutton_prompt_is_regexp = True

# Use apidoc to auto-generate rst sources
apidoc_excluded_paths = ['api_docs.py']
apidoc_extra_args = ['--private']
apidoc_excluded_paths = ['forge_utils.py']
apidoc_extra_args = ['--private', '--templatedir=_templates']
apidoc_module_dir = PACKAGE_DIR
apidoc_module_first = True
apidoc_output_dir = 'modules'
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Contents
========

.. toctree::
:maxdepth: 2
:maxdepth: 2

reference
history
contributing
reference
history
contributing


Indices and tables
Expand Down
9 changes: 8 additions & 1 deletion docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ API Reference
:glob:
:titlesonly:

modules/*
modules/aiohttp_client_cache.[!b]*

.. toctree::
:caption: Backend Modules
:glob:
:titlesonly:

modules/aiohttp_client_cache.backends.*

0 comments on commit 3883126

Please sign in to comment.