More readthedocs fixes. (#107)

* Minor fixes for readthedocs compatibility.

* Adding doc templates
This commit is contained in:
stevedodson 2020-01-10 11:33:51 +00:00 committed by GitHub
parent 1d273ae465
commit 1c772d0e50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 73 additions and 0 deletions

10
docs/_templates/api_redirect.html vendored Normal file
View File

@ -0,0 +1,10 @@
{% set redirect = redirects[pagename.split("/")[-1]] %}
<html>
<head>
<meta http-equiv="Refresh" content="0; url={{ redirect }}.html" />
<title>This API page has moved</title>
</head>
<body>
<p>This API page has moved <a href="{{ redirect }}.html">here</a>.</p>
</body>
</html>

View File

@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessor:: {{ (module.split('.')[1:] + [objname]) | join('.') }}

View File

@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessorattribute:: {{ (module.split('.')[1:] + [objname]) | join('.') }}

View File

@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessorcallable:: {{ (module.split('.')[1:] + [objname]) | join('.') }}.__call__

View File

@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessormethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }}

33
docs/_templates/autosummary/class.rst vendored Normal file
View File

@ -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 %}

View File

@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}