mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-11 19:10:58 +00:00
1556b17ca8
* Use the correct directives for a variable type and value Co-authored-by: PerchunPak <perchunpak@gmail.com> * Improve multiline value * Add colons for strings * Add another testcase Co-authored-by: PerchunPak <perchunpak@gmail.com>
38 lines
852 B
ReStructuredText
38 lines
852 B
ReStructuredText
{% if obj.display %}
|
|
.. py:{{ obj.type }}:: {{ obj.name }}
|
|
{%- if obj.annotation is not none %}
|
|
|
|
:type: {%- if obj.annotation %} {{ obj.annotation }}{%- endif %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if obj.value is not none %}
|
|
|
|
:value: {% if obj.value is string and obj.value.splitlines()|count > 1 -%}
|
|
Multiline-String
|
|
|
|
.. raw:: html
|
|
|
|
<details><summary>Show Value</summary>
|
|
|
|
.. code-block:: python
|
|
|
|
"""{{ obj.value|indent(width=8,blank=true) }}"""
|
|
|
|
.. raw:: html
|
|
|
|
</details>
|
|
|
|
{%- else -%}
|
|
{%- if obj.value is string -%}
|
|
{{ "%r" % obj.value|string|truncate(100) }}
|
|
{%- else -%}
|
|
{{ obj.value|string|truncate(100) }}
|
|
{%- endif -%}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
|
|
{{ obj.docstring|indent(3) }}
|
|
{% endif %}
|