|
21 | 21 | class="doc doc-heading",
|
22 | 22 | toc_label=class.name) %}
|
23 | 23 |
|
24 |
| - {% if config.separate_signature %} |
25 |
| - <span class="doc doc-object-name doc-class-name">{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</span> |
26 |
| - {% elif config.merge_init_into_class and "__init__" in class.members -%} |
27 |
| - {%- with function = class.members["__init__"] -%} |
28 |
| - {%- filter highlight(language="python", inline=True) -%} |
29 |
| - {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} |
30 |
| - {%- include "signature.html" with context -%} |
31 |
| - {%- endfilter -%} |
32 |
| - {%- endwith -%} |
33 |
| - {% else %} |
34 |
| - <code>{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</code> |
35 |
| - {% endif %} |
| 24 | + {% block heading scoped %} |
| 25 | + {% if config.separate_signature %} |
| 26 | + <span class="doc doc-object-name doc-class-name">{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</span> |
| 27 | + {% elif config.merge_init_into_class and "__init__" in class.members -%} |
| 28 | + {%- with function = class.members["__init__"] -%} |
| 29 | + {%- filter highlight(language="python", inline=True) -%} |
| 30 | + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} |
| 31 | + {%- include "signature.html" with context -%} |
| 32 | + {%- endfilter -%} |
| 33 | + {%- endwith -%} |
| 34 | + {% else %} |
| 35 | + <code>{% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %}</code> |
| 36 | + {% endif %} |
| 37 | + {% endblock heading %} |
36 | 38 |
|
37 |
| - {% with labels = class.labels %} |
38 |
| - {% include "labels.html" with context %} |
39 |
| - {% endwith %} |
| 39 | + {% block labels scoped %} |
| 40 | + {% with labels = class.labels %} |
| 41 | + {% include "labels.html" with context %} |
| 42 | + {% endwith %} |
| 43 | + {% endblock labels %} |
40 | 44 |
|
41 | 45 | {% endfilter %}
|
42 | 46 |
|
43 |
| - {% if config.separate_signature and config.merge_init_into_class %} |
44 |
| - {% if "__init__" in class.members %} |
45 |
| - {% with function = class.members["__init__"] %} |
46 |
| - {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} |
47 |
| - {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} |
48 |
| - {% endfilter %} |
49 |
| - {% endwith %} |
| 47 | + {% block signature scoped %} |
| 48 | + {% if config.separate_signature and config.merge_init_into_class %} |
| 49 | + {% if "__init__" in class.members %} |
| 50 | + {% with function = class.members["__init__"] %} |
| 51 | + {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} |
| 52 | + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} |
| 53 | + {% endfilter %} |
| 54 | + {% endwith %} |
| 55 | + {% endif %} |
50 | 56 | {% endif %}
|
51 |
| - {% endif %} |
| 57 | + {% endblock signature %} |
52 | 58 |
|
53 | 59 | {% else %}
|
54 | 60 | {% if config.show_root_toc_entry %}
|
|
63 | 69 | {% endif %}
|
64 | 70 |
|
65 | 71 | <div class="doc doc-contents {% if root %}first{% endif %}">
|
66 |
| - {% if config.show_bases and class.bases %} |
67 |
| - <p class="doc doc-class-bases"> |
68 |
| - Bases: {% for expression in class.bases -%} |
69 |
| - <code>{% include "expression.html" with context %}</code>{% if not loop.last %}, {% endif %} |
70 |
| - {% endfor -%} |
71 |
| - </p> |
72 |
| - {% endif %} |
73 |
| - |
74 |
| - {% with docstring_sections = class.docstring.parsed %} |
75 |
| - {% include "docstring.html" with context %} |
76 |
| - {% endwith %} |
| 72 | + {% block contents scoped %} |
| 73 | + {% block bases scoped %} |
| 74 | + {% if config.show_bases and class.bases %} |
| 75 | + <p class="doc doc-class-bases"> |
| 76 | + Bases: {% for expression in class.bases -%} |
| 77 | + <code>{% include "expression.html" with context %}</code>{% if not loop.last %}, {% endif %} |
| 78 | + {% endfor -%} |
| 79 | + </p> |
| 80 | + {% endif %} |
| 81 | + {% endblock bases %} |
77 | 82 |
|
78 |
| - {% if config.merge_init_into_class %} |
79 |
| - {% if "__init__" in class.members and class.members["__init__"].has_docstring %} |
80 |
| - {% with docstring_sections = class.members["__init__"].docstring.parsed %} |
| 83 | + {% block docstring scoped %} |
| 84 | + {% with docstring_sections = class.docstring.parsed %} |
81 | 85 | {% include "docstring.html" with context %}
|
82 | 86 | {% endwith %}
|
83 |
| - {% endif %} |
84 |
| - {% endif %} |
| 87 | + {% if config.merge_init_into_class %} |
| 88 | + {% if "__init__" in class.members and class.members["__init__"].has_docstring %} |
| 89 | + {% with docstring_sections = class.members["__init__"].docstring.parsed %} |
| 90 | + {% include "docstring.html" with context %} |
| 91 | + {% endwith %} |
| 92 | + {% endif %} |
| 93 | + {% endif %} |
| 94 | + {% endblock docstring %} |
85 | 95 |
|
86 |
| - {% if config.show_source %} |
87 |
| - {% if config.merge_init_into_class %} |
88 |
| - {% if "__init__" in class.members and class.members["__init__"].source %} |
89 |
| - <details class="quote"> |
90 |
| - <summary>Source code in <code>{{ class.relative_filepath }}</code></summary> |
91 |
| - {{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }} |
92 |
| - </details> |
| 96 | + {% block source scoped %} |
| 97 | + {% if config.show_source %} |
| 98 | + {% if config.merge_init_into_class %} |
| 99 | + {% if "__init__" in class.members and class.members["__init__"].source %} |
| 100 | + <details class="quote"> |
| 101 | + <summary>Source code in <code>{{ class.relative_filepath }}</code></summary> |
| 102 | + {{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }} |
| 103 | + </details> |
| 104 | + {% endif %} |
| 105 | + {% elif class.source %} |
| 106 | + <details class="quote"> |
| 107 | + <summary>Source code in <code>{{ class.relative_filepath }}</code></summary> |
| 108 | + {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} |
| 109 | + </details> |
| 110 | + {% endif %} |
93 | 111 | {% endif %}
|
94 |
| - {% elif class.source %} |
95 |
| - <details class="quote"> |
96 |
| - <summary>Source code in <code>{{ class.relative_filepath }}</code></summary> |
97 |
| - {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} |
98 |
| - </details> |
99 |
| - {% endif %} |
100 |
| - {% endif %} |
| 112 | + {% endblock source %} |
101 | 113 |
|
102 |
| - {% with obj = class %} |
103 |
| - {% set root = False %} |
104 |
| - {% set heading_level = heading_level + 1 %} |
105 |
| - {% include "children.html" with context %} |
106 |
| - {% endwith %} |
| 114 | + {% block children scoped %} |
| 115 | + {% with obj = class %} |
| 116 | + {% set root = False %} |
| 117 | + {% set heading_level = heading_level + 1 %} |
| 118 | + {% include "children.html" with context %} |
| 119 | + {% endwith %} |
| 120 | + {% endblock children %} |
| 121 | + {% endblock contents %} |
107 | 122 | </div>
|
108 | 123 |
|
109 | 124 | {% endwith %}
|
|
0 commit comments