| 1 |
{#- Template for members (children) of an object. |
| 2 |
|
| 3 |
This template iterates on members of a given object and renders them. |
| 4 |
It can group members by category (attributes, classes, functions, modules) or render them in a flat list. |
| 5 |
|
| 6 |
Context: |
| 7 |
obj (griffe.Object): The object to render. |
| 8 |
config (dict): The configuration options. |
| 9 |
root_members (bool): Whether the object is the root object. |
| 10 |
heading_level (int): The HTML heading level to use. |
| 11 |
-#} |
| 12 |
|
| 13 |
{% if obj.all_members %} |
| 14 |
{% block logs scoped %} |
| 15 |
{#- Logging block. |
| 16 |
|
| 17 |
This block can be used to log debug messages, deprecation messages, warnings, etc. |
| 18 |
-#} |
| 19 |
{{ log.debug("Rendering children of " + obj.path) }} |
| 20 |
{% endblock logs %} |
| 21 |
|
| 22 |
{% import "language.html.jinja" as lang with context %} |
| 23 |
{#- Language module providing the `t` translation method. -#} |
| 24 |
|
| 25 |
<div class="doc doc-children"> |
| 26 |
|
| 27 |
{% if root_members %} |
| 28 |
{% set members_list = config.members %} |
| 29 |
{% else %} |
| 30 |
{% set members_list = none %} |
| 31 |
{% endif %} |
| 32 |
|
| 33 |
{% if config.group_by_category %} |
| 34 |
|
| 35 |
{% with %} |
| 36 |
|
| 37 |
{% if config.show_category_heading %} |
| 38 |
{% set extra_level = 1 %} |
| 39 |
{% else %} |
| 40 |
{% set extra_level = 0 %} |
| 41 |
{% endif %} |
| 42 |
|
| 43 |
{% with attributes = obj.attributes|filter_objects( |
| 44 |
filters=config.filters, |
| 45 |
members_list=members_list, |
| 46 |
inherited_members=config.inherited_members, |
| 47 |
keep_no_docstrings=config.show_if_no_docstring, |
| 48 |
) %} |
| 49 |
{% if attributes %} |
| 50 |
{% if config.show_category_heading %} |
| 51 |
{% filter heading(heading_level, id=html_id ~ "-attributes", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Attributes") }}{% endfilter %} |
| 52 |
{% endif %} |
| 53 |
{% with heading_level = heading_level + extra_level %} |
| 54 |
{% for attribute in attributes|order_members(config.members_order, members_list) %} |
| 55 |
{% if config.filters == "public" or members_list is not none or (not attribute.is_imported or attribute.is_public) %} |
| 56 |
{% include attribute|get_template with context %} |
| 57 |
{% endif %} |
| 58 |
{% endfor %} |
| 59 |
{% endwith %} |
| 60 |
{% endif %} |
| 61 |
{% endwith %} |
| 62 |
|
| 63 |
{% with type_aliases = obj.type_aliases|filter_objects( |
| 64 |
filters=config.filters, |
| 65 |
members_list=members_list, |
| 66 |
inherited_members=config.inherited_members, |
| 67 |
keep_no_docstrings=config.show_if_no_docstring, |
| 68 |
) %} |
| 69 |
{% if type_aliases %} |
| 70 |
{% if config.show_category_heading %} |
| 71 |
{% filter heading(heading_level, id=html_id ~ "-type_aliases") %}{{ lang.t("Type Aliases") }}{% endfilter %} |
| 72 |
{% endif %} |
| 73 |
{% with heading_level = heading_level + extra_level %} |
| 74 |
{% for type_alias in type_aliases|order_members(config.members_order, members_list) %} |
| 75 |
{% if config.filters == "public" or members_list is not none or (not type_alias.is_imported or type_alias.is_public) %} |
| 76 |
{% include type_alias|get_template with context %} |
| 77 |
{% endif %} |
| 78 |
{% endfor %} |
| 79 |
{% endwith %} |
| 80 |
{% endif %} |
| 81 |
{% endwith %} |
| 82 |
|
| 83 |
{% with classes = obj.classes|filter_objects( |
| 84 |
filters=config.filters, |
| 85 |
members_list=members_list, |
| 86 |
inherited_members=config.inherited_members, |
| 87 |
keep_no_docstrings=config.show_if_no_docstring, |
| 88 |
) %} |
| 89 |
{% if classes %} |
| 90 |
{% if config.show_category_heading %} |
| 91 |
{% filter heading(heading_level, id=html_id ~ "-classes", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Classes") }}{% endfilter %} |
| 92 |
{% endif %} |
| 93 |
{% with heading_level = heading_level + extra_level %} |
| 94 |
{% for class in classes|order_members(config.members_order, members_list) %} |
| 95 |
{% if config.filters == "public" or members_list is not none or (not class.is_imported or class.is_public) %} |
| 96 |
{% include class|get_template with context %} |
| 97 |
{% endif %} |
| 98 |
{% endfor %} |
| 99 |
{% endwith %} |
| 100 |
{% endif %} |
| 101 |
{% endwith %} |
| 102 |
|
| 103 |
{% with functions = obj.functions|filter_objects( |
| 104 |
filters=config.filters, |
| 105 |
members_list=members_list, |
| 106 |
inherited_members=config.inherited_members, |
| 107 |
keep_no_docstrings=config.show_if_no_docstring, |
| 108 |
) %} |
| 109 |
{% if functions %} |
| 110 |
{% if config.show_category_heading %} |
| 111 |
{% filter heading(heading_level, id=html_id ~ "-functions", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}{% endfilter %} |
| 112 |
{% endif %} |
| 113 |
{% with heading_level = heading_level + extra_level %} |
| 114 |
{% for function in functions|order_members(config.members_order, members_list) %} |
| 115 |
{% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %} |
| 116 |
{% if config.filters == "public" or members_list is not none or (not function.is_imported or function.is_public) %} |
| 117 |
{% include function|get_template with context %} |
| 118 |
{% endif %} |
| 119 |
{% endif %} |
| 120 |
{% endfor %} |
| 121 |
{% endwith %} |
| 122 |
{% endif %} |
| 123 |
{% endwith %} |
| 124 |
|
| 125 |
{% if config.show_submodules %} |
| 126 |
{% with modules = obj.modules|filter_objects( |
| 127 |
filters=config.filters, |
| 128 |
members_list=members_list, |
| 129 |
inherited_members=config.inherited_members, |
| 130 |
keep_no_docstrings=config.show_if_no_docstring, |
| 131 |
) %} |
| 132 |
{% if modules %} |
| 133 |
{% if config.show_category_heading %} |
| 134 |
{% filter heading(heading_level, id=html_id ~ "-modules", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Modules") }}{% endfilter %} |
| 135 |
{% endif %} |
| 136 |
{% with heading_level = heading_level + extra_level %} |
| 137 |
{% for module in modules|order_members("alphabetical", members_list) %} |
| 138 |
{% if config.filters == "public" or members_list is not none or (not module.is_alias or module.is_public) %} |
| 139 |
{% include module|get_template with context %} |
| 140 |
{% endif %} |
| 141 |
{% endfor %} |
| 142 |
{% endwith %} |
| 143 |
{% endif %} |
| 144 |
{% endwith %} |
| 145 |
{% endif %} |
| 146 |
|
| 147 |
{% endwith %} |
| 148 |
|
| 149 |
{% else %} |
| 150 |
|
| 151 |
{% for child in obj.all_members |
| 152 |
|filter_objects( |
| 153 |
filters=config.filters, |
| 154 |
members_list=members_list, |
| 155 |
inherited_members=config.inherited_members, |
| 156 |
keep_no_docstrings=config.show_if_no_docstring, |
| 157 |
) |
| 158 |
|order_members(config.members_order, members_list) |
| 159 |
%} |
| 160 |
|
| 161 |
{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %} |
| 162 |
|
| 163 |
{% if config.filters == "public" or members_list is not none or (not child.is_imported or child.is_public) %} |
| 164 |
{% if child.is_attribute %} |
| 165 |
{% with attribute = child %} |
| 166 |
{% include attribute|get_template with context %} |
| 167 |
{% endwith %} |
| 168 |
|
| 169 |
{% elif child.is_type_alias %} |
| 170 |
{% with type_alias = child %} |
| 171 |
{% include type_alias|get_template with context %} |
| 172 |
{% endwith %} |
| 173 |
|
| 174 |
{% elif child.is_class %} |
| 175 |
{% with class = child %} |
| 176 |
{% include class|get_template with context %} |
| 177 |
{% endwith %} |
| 178 |
|
| 179 |
{% elif child.is_function %} |
| 180 |
{% with function = child %} |
| 181 |
{% include function|get_template with context %} |
| 182 |
{% endwith %} |
| 183 |
|
| 184 |
{% elif child.is_module and config.show_submodules %} |
| 185 |
{% with module = child %} |
| 186 |
{% include module|get_template with context %} |
| 187 |
{% endwith %} |
| 188 |
|
| 189 |
{% endif %} |
| 190 |
{% endif %} |
| 191 |
|
| 192 |
{% endif %} |
| 193 |
|
| 194 |
{% endfor %} |
| 195 |
|
| 196 |
{% endif %} |
| 197 |
|
| 198 |
</div> |
| 199 |
|
| 200 |
{% endif %} |