mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 18:16:03 +01:00
enable autosummary in sphinx
This commit is contained in:
parent
dcb5456162
commit
d9c66bf77f
@ -56,7 +56,7 @@ endif()
|
||||
add_custom_target(${PROJECT_NAME}_docs_sphinx ALL)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}_docs_sphinx
|
||||
COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html
|
||||
COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python/${PROJECT_NAME}:${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -c . -b html ${CMAKE_CURRENT_SOURCE_DIR} html
|
||||
)
|
||||
|
||||
option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF)
|
||||
|
32
doc/_templates/autosummary_class_template.rst
vendored
Normal file
32
doc/_templates/autosummary_class_template.rst
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{{ fullname | escape | underline}}
|
||||
|
||||
.. currentmodule:: {{ module }}
|
||||
|
||||
.. autoclass:: {{ objname }}
|
||||
:members:
|
||||
:show-inheritance:
|
||||
:inherited-members:
|
||||
|
||||
{% block methods %}
|
||||
.. automethod:: __init__
|
||||
|
||||
{% if methods %}
|
||||
.. rubric:: {{ _('Methods') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in methods %}
|
||||
~{{ name }}.{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block attributes %}
|
||||
{% if attributes %}
|
||||
.. rubric:: {{ _('Attributes') }}
|
||||
|
||||
.. autosummary::
|
||||
{% for item in attributes %}
|
||||
~{{ name }}.{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
68
doc/_templates/autosummary_module_template.rst
vendored
Normal file
68
doc/_templates/autosummary_module_template.rst
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{{ fullname | escape | underline}}
|
||||
|
||||
.. automodule:: {{ fullname }}
|
||||
|
||||
{% block functions %}
|
||||
{% if functions %}
|
||||
.. rubric:: Functions
|
||||
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
{% for item in functions %}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block attributes %}
|
||||
{% if attributes %}
|
||||
.. rubric:: Module Attributes
|
||||
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
{% for item in attributes %}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block classes %}
|
||||
{% if classes %}
|
||||
.. rubric:: {{ _('Classes') }}
|
||||
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
:template: autosummary_class_template.rst
|
||||
{% for item in classes %}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block exceptions %}
|
||||
{% if exceptions %}
|
||||
.. rubric:: {{ _('Exceptions') }}
|
||||
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
{% for item in exceptions %}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block modules %}
|
||||
{% if modules %}
|
||||
.. rubric:: Modules
|
||||
|
||||
.. autosummary::
|
||||
:toctree:
|
||||
:template: autosummary_module_template.rst
|
||||
:recursive:
|
||||
|
||||
{% for item in modules %}
|
||||
{{ item }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -6,6 +6,9 @@ import sys
|
||||
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext")
|
||||
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext/numpydoc")
|
||||
|
||||
# exclude these folders from scanning by sphinx
|
||||
exclude_patterns = ['_templates']
|
||||
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.intersphinx',
|
||||
@ -39,6 +42,10 @@ pygments_style = 'sphinx'
|
||||
|
||||
source_suffix = '.rst'
|
||||
|
||||
# Turn on sphinx.ext.autosummary
|
||||
autosummary_generate = True
|
||||
autosummary_imported_members=False
|
||||
|
||||
project = '@PROJECT_NAME@'
|
||||
version = '@PROJECT_VERSION@'
|
||||
|
||||
|
@ -21,10 +21,9 @@ C++ reference manual
|
||||
Python reference manual
|
||||
=======================
|
||||
|
||||
.. automodule:: app4triqs
|
||||
:members:
|
||||
.. autosummary::
|
||||
:toctree: _autosummary
|
||||
:template: autosummary_module_template.rst
|
||||
:recursive:
|
||||
|
||||
.. autoclass:: app4triqs.app4triqs_module.Toto
|
||||
:members:
|
||||
|
||||
.. autofunction:: app4triqs.app4triqs_module.chain
|
||||
app4triqs_module
|
||||
|
Loading…
Reference in New Issue
Block a user