|
| 1 | +{{ log.debug("Rendering attributes section") }} |
| 2 | + |
| 3 | +{% import "language.html" as lang with context %} |
| 4 | + |
| 5 | +{% if config.docstring_section_style == "table" %} |
| 6 | + {% block table_style scoped %} |
| 7 | + <p><strong>{{ section.title or lang.t("Attributes:") }}</strong></p> |
| 8 | + <table> |
| 9 | + <thead> |
| 10 | + <tr> |
| 11 | + <th>{{ lang.t("Name") }}</th> |
| 12 | + <th>{{ lang.t("Type") }}</th> |
| 13 | + <th>{{ lang.t("Description") }}</th> |
| 14 | + </tr> |
| 15 | + </thead> |
| 16 | + <tbody> |
| 17 | + {% for attribute in section.value %} |
| 18 | + <tr> |
| 19 | + <td><code><span data-autorefs-optional-hover="{{ obj.path }}.{{ attribute.name }}">{{ attribute.name }}</span></code></td> |
| 20 | + <td> |
| 21 | + {% if attribute.annotation %} |
| 22 | + {% with expression = attribute.annotation %} |
| 23 | + <code>{% include "expression.html" with context %}</code> |
| 24 | + {% endwith %} |
| 25 | + {% endif %} |
| 26 | + </td> |
| 27 | + <td> |
| 28 | + <div class="doc-md-description"> |
| 29 | + {{ attribute.description|convert_markdown(heading_level, html_id) }} |
| 30 | + </div> |
| 31 | + </td> |
| 32 | + </tr> |
| 33 | + {% endfor %} |
| 34 | + </tbody> |
| 35 | + </table> |
| 36 | + {% endblock table_style %} |
| 37 | +{% elif config.docstring_section_style == "list" %} |
| 38 | + {% block list_style scoped %} |
| 39 | + <p>{{ section.title or lang.t("Attributes:") }}</p> |
| 40 | + <ul> |
| 41 | + {% for attribute in section.value %} |
| 42 | + <li class="field-body"> |
| 43 | + <b><code><span data-autorefs-optional-hover="{{ obj.path }}.{{ attribute.name }}">{{ attribute.name }}</span></code></b> |
| 44 | + {% if attribute.annotation %} |
| 45 | + {% with expression = attribute.annotation %} |
| 46 | + (<code>{% include "expression.html" with context %}</code>) |
| 47 | + {% endwith %} |
| 48 | + {% endif %} |
| 49 | + – |
| 50 | + <div class="doc-md-description"> |
| 51 | + {{ attribute.description|convert_markdown(heading_level, html_id) }} |
| 52 | + </div> |
| 53 | + </li> |
| 54 | + {% endfor %} |
| 55 | + </ul> |
| 56 | + {% endblock list_style %} |
| 57 | +{% elif config.docstring_section_style == "spacy" %} |
| 58 | + {% block spacy_style scoped %} |
| 59 | + <table> |
| 60 | + <thead> |
| 61 | + <tr> |
| 62 | + <th><b>{{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}</b></th> |
| 63 | + <th><b>{{ lang.t("DESCRIPTION") }}</b></th> |
| 64 | + </tr> |
| 65 | + </thead> |
| 66 | + <tbody> |
| 67 | + {% for attribute in section.value %} |
| 68 | + <tr> |
| 69 | + <td><code><span data-autorefs-optional-hover="{{ obj.path }}.{{ attribute.name }}">{{ attribute.name }}</span></code></td> |
| 70 | + <td class="doc-attribute-details"> |
| 71 | + <div class="doc-md-description"> |
| 72 | + {{ attribute.description|convert_markdown(heading_level, html_id) }} |
| 73 | + </div> |
| 74 | + <p> |
| 75 | + {% if attribute.annotation %} |
| 76 | + <span class="doc-attribute-annotation"> |
| 77 | + <b>TYPE:</b> |
| 78 | + {% with expression = attribute.annotation %} |
| 79 | + <code>{% include "expression.html" with context %}</code> |
| 80 | + {% endwith %} |
| 81 | + </span> |
| 82 | + {% endif %} |
| 83 | + </p> |
| 84 | + </td> |
| 85 | + </tr> |
| 86 | + {% endfor %} |
| 87 | + </tbody> |
| 88 | + </table> |
| 89 | + {% endblock spacy_style %} |
| 90 | +{% endif %} |
0 commit comments