From 1c772d0e50210ef98f2e2c5396ebedb1f56f58c5 Mon Sep 17 00:00:00 2001 From: stevedodson Date: Fri, 10 Jan 2020 11:33:51 +0000 Subject: [PATCH] More readthedocs fixes. (#107) * Minor fixes for readthedocs compatibility. * Adding doc templates --- docs/_templates/api_redirect.html | 10 ++++++ docs/_templates/autosummary/accessor.rst | 6 ++++ .../autosummary/accessor_attribute.rst | 6 ++++ .../autosummary/accessor_callable.rst | 6 ++++ .../autosummary/accessor_method.rst | 6 ++++ docs/_templates/autosummary/class.rst | 33 +++++++++++++++++++ .../autosummary/class_without_autosummary.rst | 6 ++++ 7 files changed, 73 insertions(+) create mode 100644 docs/_templates/api_redirect.html create mode 100644 docs/_templates/autosummary/accessor.rst create mode 100644 docs/_templates/autosummary/accessor_attribute.rst create mode 100644 docs/_templates/autosummary/accessor_callable.rst create mode 100644 docs/_templates/autosummary/accessor_method.rst create mode 100644 docs/_templates/autosummary/class.rst create mode 100644 docs/_templates/autosummary/class_without_autosummary.rst diff --git a/docs/_templates/api_redirect.html b/docs/_templates/api_redirect.html new file mode 100644 index 0000000..c04a8b5 --- /dev/null +++ b/docs/_templates/api_redirect.html @@ -0,0 +1,10 @@ +{% set redirect = redirects[pagename.split("/")[-1]] %} + + + + This API page has moved + + +

This API page has moved here.

+ + diff --git a/docs/_templates/autosummary/accessor.rst b/docs/_templates/autosummary/accessor.rst new file mode 100644 index 0000000..4ba745c --- /dev/null +++ b/docs/_templates/autosummary/accessor.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module.split('.')[0] }} + +.. autoaccessor:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/docs/_templates/autosummary/accessor_attribute.rst b/docs/_templates/autosummary/accessor_attribute.rst new file mode 100644 index 0000000..b5ad65d --- /dev/null +++ b/docs/_templates/autosummary/accessor_attribute.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module.split('.')[0] }} + +.. autoaccessorattribute:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/docs/_templates/autosummary/accessor_callable.rst b/docs/_templates/autosummary/accessor_callable.rst new file mode 100644 index 0000000..7a33018 --- /dev/null +++ b/docs/_templates/autosummary/accessor_callable.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module.split('.')[0] }} + +.. autoaccessorcallable:: {{ (module.split('.')[1:] + [objname]) | join('.') }}.__call__ diff --git a/docs/_templates/autosummary/accessor_method.rst b/docs/_templates/autosummary/accessor_method.rst new file mode 100644 index 0000000..aefbba6 --- /dev/null +++ b/docs/_templates/autosummary/accessor_method.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module.split('.')[0] }} + +.. autoaccessormethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst new file mode 100644 index 0000000..a9c9bd2 --- /dev/null +++ b/docs/_templates/autosummary/class.rst @@ -0,0 +1,33 @@ +{% extends "!autosummary/class.rst" %} + +{% block methods %} +{% if methods %} + +.. + HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. + .. autosummary:: + :toctree: + {% for item in all_methods %} + {%- if not item.startswith('_') or item in ['__call__'] %} + {{ name }}.{{ item }} + {%- endif -%} + {%- endfor %} + +{% endif %} +{% endblock %} + +{% block attributes %} +{% if attributes %} + +.. + HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. + .. autosummary:: + :toctree: + {% for item in all_attributes %} + {%- if not item.startswith('_') %} + {{ name }}.{{ item }} + {%- endif -%} + {%- endfor %} + +{% endif %} +{% endblock %} diff --git a/docs/_templates/autosummary/class_without_autosummary.rst b/docs/_templates/autosummary/class_without_autosummary.rst new file mode 100644 index 0000000..6676c67 --- /dev/null +++ b/docs/_templates/autosummary/class_without_autosummary.rst @@ -0,0 +1,6 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }}