From 3aa1747795334245127fca698bae5dbd9f7a609d Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 25 Aug 2016 16:23:48 -0700 Subject: [PATCH] Template updates. --- autoapi/templates/index.rst | 10 ++++++---- autoapi/templates/python/class.rst | 6 ++---- autoapi/templates/python/function.rst | 2 +- autoapi/templates/python/method.rst | 4 ++-- autoapi/templates/python/module.rst | 6 ++---- autoapi/templates/python/package.rst | 19 +++++++++++++++++++ 6 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 autoapi/templates/python/package.rst diff --git a/autoapi/templates/index.rst b/autoapi/templates/index.rst index f024b5d..0a80174 100644 --- a/autoapi/templates/index.rst +++ b/autoapi/templates/index.rst @@ -9,8 +9,10 @@ Below is a list of all items that are documented here. :glob: :maxdepth: 1 - {%- for page in pages|sort %} - {% if page.top_level_object %} - /autoapi/{{ page.id.split('.')|join('/') }}/index - {% endif %} + {# Force whitespace #} + + {%- for page in pages %} + {%- if page.top_level_object %} + {{ page.include_path }} + {%- endif %} {%- endfor %} diff --git a/autoapi/templates/python/class.rst b/autoapi/templates/python/class.rst index 0dd7b51..d6360a1 100644 --- a/autoapi/templates/python/class.rst +++ b/autoapi/templates/python/class.rst @@ -1,14 +1,12 @@ {% if not 'nested' in obj._human %} -{{ obj.short_name }} -{{ "-" * obj.short_name|length }} +Class {{ obj.short_name }} +~~~~~~{{ "~" * obj.short_name|length }} {% endif %} .. py:class:: {{ obj.short_name }}{% if obj.args %}({{ obj.args|join(',') }}){% endif %} {%- if obj.docstring %} - .. rubric:: Summary - {{ obj.docstring|indent(3) }} {% endif %} diff --git a/autoapi/templates/python/function.rst b/autoapi/templates/python/function.rst index 658cded..e853603 100644 --- a/autoapi/templates/python/function.rst +++ b/autoapi/templates/python/function.rst @@ -1,6 +1,6 @@ {%- if obj.display %} -.. function:: {{ obj.name.split('.')[-1] }}({{ obj.args|join(',') }}) +.. function:: {{ obj.name }}({{ obj.args|join(',') }}) {% if obj.docstring %} {{ obj.docstring.strip()|indent(3) }} diff --git a/autoapi/templates/python/method.rst b/autoapi/templates/python/method.rst index 137f1a3..68d1535 100644 --- a/autoapi/templates/python/method.rst +++ b/autoapi/templates/python/method.rst @@ -1,9 +1,9 @@ {%- if obj.display %} -.. method:: {{ obj.name.split('.')[-1] }}({{ obj.args[1:]|join(',') }}) +.. method:: {{ obj.name }}({{ obj.args[1:]|join(',') }}) {% if obj.docstring %} - {{ obj.docstring.strip()|indent(3) }} + {{ obj.docstring }} {% endif %} {% endif %} \ No newline at end of file diff --git a/autoapi/templates/python/module.rst b/autoapi/templates/python/module.rst index 99ef2ef..5c9d0df 100644 --- a/autoapi/templates/python/module.rst +++ b/autoapi/templates/python/module.rst @@ -1,10 +1,8 @@ -{{ obj.name }} -{{ "~" * obj.name|length }} +Module {{ obj.name }} +-------{{ "-" * obj.name|length }} {%- if obj.docstring %} -.. rubric:: Summary - {{ obj.docstring }} {% endif %} diff --git a/autoapi/templates/python/package.rst b/autoapi/templates/python/package.rst new file mode 100644 index 0000000..bae32ba --- /dev/null +++ b/autoapi/templates/python/package.rst @@ -0,0 +1,19 @@ +Package {{ obj.name }} +========{{ "=" * obj.name|length }} + +{%- if obj.docstring %} + +{{ obj.docstring }} + +{% endif %} + +.. py:module:: {{ obj.name }} + +{% block content %} +{%- for obj_item in obj.children %} + +{{ obj_item.rendered|indent(0) }} + +{%- endfor %} +{% endblock %} +