|
14 | 14 | - {{ obj.summary }}
|
15 | 15 | {% endfor %}
|
16 | 16 | {%- endmacro %}
|
17 |
| -{# --------------------------- End macros definition ----------------------- #} |
| 17 | + |
| 18 | +{# ------------------------ End macros definition for tab ------------------- #} |
| 19 | + |
| 20 | +{# ----------------- Start macros definition for autosummary -----------------#} |
| 21 | + |
| 22 | +{% macro render_autosummary_section(title, members) -%} |
| 23 | + |
| 24 | +{{ title }} |
| 25 | +{{ "-" * title | length }} |
| 26 | + |
| 27 | +.. autoapisummary:: |
| 28 | + |
| 29 | + {% for member in members %} |
| 30 | + {{ member.id }} |
| 31 | + {% endfor %} |
| 32 | + |
| 33 | +{%- endmacro %} |
| 34 | +{# ------------------ End macros definition for autosummary --------------- #} |
| 35 | + |
| 36 | +{# ----------------- Start macros definition for headers -----------------#} |
| 37 | + |
| 38 | +{% macro render_members_section(title, members) -%} |
| 39 | + |
| 40 | +{{ title }} |
| 41 | +{{ "-" * title | length }} |
| 42 | + |
| 43 | + {% for member in members %} |
| 44 | +{{ member.render() }} |
| 45 | + {% endfor %} |
| 46 | + |
| 47 | +{%- endmacro %} |
| 48 | +{# ------------------ End macros definition for headers --------------- #} |
| 49 | + |
18 | 50 |
|
19 | 51 | {% if is_own_page %}
|
20 | 52 | :class:`{{ obj.name }}`
|
@@ -140,84 +172,40 @@ Import detail
|
140 | 172 | from {{ joined_parts }} import {{ obj["short_name"] }}
|
141 | 173 |
|
142 | 174 | {% if visible_properties %}
|
143 |
| -Property detail |
144 |
| ---------------- |
145 |
| - {% for property in visible_properties %} |
146 |
| -{{ property.render() }} |
147 |
| - {% endfor %} |
| 175 | +{{ render_members_section("Property detail", visible_properties) }} |
148 | 176 | {% endif %}
|
149 | 177 |
|
150 |
| - |
151 |
| - {% if visible_attributes %} |
152 |
| -Attribute detail |
153 |
| ----------------- |
154 |
| - {% for attribute in visible_attributes %} |
155 |
| -{{ attribute.render() }} |
156 |
| - {% endfor %} |
| 178 | + {% if visible_attributes %} |
| 179 | +{{ render_members_section("Attribute detail", visible_attributes) }} |
157 | 180 | {% endif %}
|
158 | 181 |
|
159 |
| - |
160 |
| - {% if all_visible_methods %} |
161 |
| -Method detail |
162 |
| -------------- |
163 |
| - {% for method in all_visible_methods %} |
164 |
| -{{ method.render() }} |
165 |
| - {% endfor %} |
| 182 | + {% if all_visible_methods %} |
| 183 | +{{ render_members_section("Method detail", all_visible_methods) }} |
166 | 184 | {% endif %}
|
| 185 | + |
167 | 186 | {% if is_own_page and own_page_children %}
|
168 | 187 | {% set visible_attributes = own_page_children|selectattr("type", "equalto", "attribute")|list %}
|
169 |
| - {% if visible_attributes %} |
170 |
| -Attributes |
171 |
| ----------- |
172 |
| - |
173 |
| -.. autoapisummary:: |
174 |
| - |
175 |
| - {% for attribute in visible_attributes %} |
176 |
| - {{ attribute.id }} |
177 |
| - {% endfor %} |
178 |
| - |
179 |
| - |
180 |
| - {% endif %} |
181 |
| - {% set visible_exceptions = own_page_children|selectattr("type", "equalto", "exception")|list %} |
182 |
| - {% if visible_exceptions %} |
183 |
| -Exceptions |
184 |
| ----------- |
185 |
| - |
186 |
| -.. autoapisummary:: |
187 |
| - |
188 |
| - {% for exception in visible_exceptions %} |
189 |
| - {{ exception.id }} |
190 |
| - {% endfor %} |
191 |
| - |
192 |
| - |
193 |
| - {% endif %} |
194 |
| - {% set visible_classes = own_page_children|selectattr("type", "equalto", "class")|list %} |
195 |
| - {% if visible_classes %} |
196 |
| -Classes |
197 |
| -------- |
198 | 188 |
|
199 |
| -.. autoapisummary:: |
200 |
| - |
201 |
| - {% for klass in visible_classes %} |
202 |
| - {{ klass.id }} |
203 |
| - {% endfor %} |
204 |
| - |
205 |
| - |
206 |
| - {% endif %} |
207 |
| - {% set visible_methods = own_page_children|selectattr("type", "equalto", "method")|list %} |
208 |
| - {% if visible_methods %} |
209 |
| -Methods |
210 |
| -------- |
| 189 | + {% if visible_attributes %} |
| 190 | +{{ autosummary_section("Attributes", visible_attributes) }} |
| 191 | + {% endif %} |
| 192 | + {% set visible_exceptions = own_page_children|selectattr("type", "equalto", "exception")|list %} |
211 | 193 |
|
212 |
| -.. autoapisummary:: |
| 194 | + {% if visible_exceptions %} |
| 195 | +{{ autosummary_section("Exceptions", visible_exceptions) }} |
| 196 | + {% endif %} |
| 197 | + {% set visible_classes = own_page_children|selectattr("type", "equalto", "class")|list %} |
213 | 198 |
|
214 |
| - {% for method in visible_methods %} |
215 |
| - {{ method.id }} |
216 |
| - {% endfor %} |
| 199 | + {% if visible_classes %} |
| 200 | +{{ autosummary_section("Classes", visible_classes) }} |
217 | 201 |
|
| 202 | + {% endif %} |
| 203 | + {% set visible_methods = own_page_children|selectattr("type", "equalto", "method")|list %} |
218 | 204 |
|
219 |
| - {% endif %} |
| 205 | + {% if visible_methods %} |
| 206 | +{{ autosummary_section("Methods", visible_methods) }} |
| 207 | + {% endif %} |
220 | 208 | {% endif %}
|
221 | 209 |
|
222 | 210 | {# ---------------------- End class details -------------------- #}
|
223 |
| -{% endif %} |
| 211 | +{% endif %} |
0 commit comments