From b482e38ca2e81b241b3c16f72d5df9296a267389 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 2 May 2019 19:31:28 +0900 Subject: apidoc: Use a template for generating module file --- sphinx/templates/apidoc/module.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sphinx/templates/apidoc/module.rst (limited to 'sphinx/templates') diff --git a/sphinx/templates/apidoc/module.rst b/sphinx/templates/apidoc/module.rst new file mode 100644 index 000000000..249027855 --- /dev/null +++ b/sphinx/templates/apidoc/module.rst @@ -0,0 +1,9 @@ +{%- if show_headings %} +{{- [basename, "module"] | join(' ') | e | heading }} + +{% endif -%} +.. automodule:: {{ qualname }} +{%- for option in automodule_options %} + :{{ option }}: +{%- endfor %} + -- cgit v1.2.3 From e41d6f3651416ca6ce31d637b572895264661f00 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 2 May 2019 22:40:36 +0900 Subject: apidoc: Use a template for generating toc file --- sphinx/templates/apidoc/toc.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sphinx/templates/apidoc/toc.rst (limited to 'sphinx/templates') diff --git a/sphinx/templates/apidoc/toc.rst b/sphinx/templates/apidoc/toc.rst new file mode 100644 index 000000000..291a19402 --- /dev/null +++ b/sphinx/templates/apidoc/toc.rst @@ -0,0 +1,9 @@ +{{ header | heading }} + +.. toctree:: + :maxdepth: {{ maxdepth }} + +{% for docname in docnames %} + {{ docname }} +{%- endfor %} + -- cgit v1.2.3 From b93f53c7e4c84922a77f63cc0e1dca0a60a72201 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 4 May 2019 01:16:07 +0900 Subject: apidoc: Use a template for generating package file --- sphinx/templates/apidoc/package.rst | 52 +++++++++++++++++++++++++++++++++++++ sphinx/templates/apidoc/toc.rst | 1 - 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 sphinx/templates/apidoc/package.rst (limited to 'sphinx/templates') diff --git a/sphinx/templates/apidoc/package.rst b/sphinx/templates/apidoc/package.rst new file mode 100644 index 000000000..0026af34c --- /dev/null +++ b/sphinx/templates/apidoc/package.rst @@ -0,0 +1,52 @@ +{%- macro automodule(modname, options) -%} +.. automodule:: {{ modname }} +{%- for option in options %} + :{{ option }}: +{%- endfor %} +{%- endmacro %} + +{%- macro toctree(docnames) -%} +.. toctree:: +{% for docname in docnames %} + {{ docname }} +{%- endfor %} +{%- endmacro %} + +{%- if is_namespace %} +{{- [pkgname, "namespace"] | join(" ") | e | heading }} +{% else %} +{{- [pkgname, "package"] | join(" ") | e | heading }} +{% endif %} + +{%- if modulefirst and not is_namespace %} +{{ automodule(pkgname, automodule_options) }} +{% endif %} + +{%- if subpackages %} +Subpackages +----------- + +{{ toctree(subpackages) }} +{% endif %} + +{%- if submodules %} +Submodules +---------- +{% if separatemodules %} +{{ toctree(submodules) }} +{%- else %} +{%- for submodule in submodules %} +{% if show_headings %} +{{- [submodule, "module"] | join(" ") | e | heading(2) }} +{% endif %} +{{ automodule(submodule, automodule_options) }} +{%- endfor %} +{% endif %} +{% endif %} + +{%- if not modulefirst and not is_namespace %} +Module contents +--------------- + +{{ automodule(pkgname, automodule_options) }} +{% endif %} diff --git a/sphinx/templates/apidoc/toc.rst b/sphinx/templates/apidoc/toc.rst index 291a19402..f0877eeb2 100644 --- a/sphinx/templates/apidoc/toc.rst +++ b/sphinx/templates/apidoc/toc.rst @@ -2,7 +2,6 @@ .. toctree:: :maxdepth: {{ maxdepth }} - {% for docname in docnames %} {{ docname }} {%- endfor %} -- cgit v1.2.3