mkdocstrings-matlab 0.9.7__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mkdocstrings_handlers/matlab/__init__.py +26 -3
- mkdocstrings_handlers/matlab/config.py +885 -0
- mkdocstrings_handlers/matlab/handler.py +155 -296
- mkdocstrings_handlers/matlab/logger.py +111 -0
- mkdocstrings_handlers/matlab/rendering.py +818 -0
- mkdocstrings_handlers/matlab/templates/material/attributes.html.jinja +25 -0
- mkdocstrings_handlers/matlab/templates/material/backlinks.html.jinja +17 -0
- mkdocstrings_handlers/matlab/templates/material/children.html.jinja +70 -62
- mkdocstrings_handlers/matlab/templates/material/class.html.jinja +236 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/admonition.html.jinja +20 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/classes.html.jinja +85 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/examples.html.jinja +27 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/functions.html.jinja +91 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/input_arguments.html.jinja +171 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/name_value_arguments.html.jinja +166 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/namespaces.html.jinja +5 -6
- mkdocstrings_handlers/matlab/templates/material/docstring/output_arguments.html.jinja +152 -0
- mkdocstrings_handlers/matlab/templates/material/docstring/properties.html.jinja +25 -26
- mkdocstrings_handlers/matlab/templates/material/docstring.html.jinja +53 -0
- mkdocstrings_handlers/matlab/templates/material/expression.html.jinja +55 -0
- mkdocstrings_handlers/matlab/templates/material/folder.html.jinja +31 -39
- mkdocstrings_handlers/matlab/templates/material/function.html.jinja +148 -0
- mkdocstrings_handlers/matlab/templates/material/language.html.jinja +18 -0
- mkdocstrings_handlers/matlab/templates/material/languages/en.html.jinja +38 -0
- mkdocstrings_handlers/matlab/templates/material/languages/ja.html.jinja +38 -0
- mkdocstrings_handlers/matlab/templates/material/languages/zh.html.jinja +38 -0
- mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja +32 -38
- mkdocstrings_handlers/matlab/templates/material/property.html.jinja +39 -35
- mkdocstrings_handlers/matlab/templates/material/script.html.jinja +3 -25
- mkdocstrings_handlers/matlab/templates/material/signature.html.jinja +105 -0
- mkdocstrings_handlers/matlab/templates/material/style.css +179 -4
- mkdocstrings_handlers/matlab/templates/material/summary/classes.html.jinja +25 -0
- mkdocstrings_handlers/matlab/templates/material/summary/functions.html.jinja +25 -0
- mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja +17 -13
- mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja +17 -13
- mkdocstrings_handlers/matlab/templates/material/summary.html.jinja +6 -6
- {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/METADATA +17 -19
- mkdocstrings_matlab-1.0.0.dist-info/RECORD +41 -0
- mkdocstrings_handlers/matlab/collect.py +0 -783
- mkdocstrings_handlers/matlab/enums.py +0 -54
- mkdocstrings_handlers/matlab/models.py +0 -633
- mkdocstrings_handlers/matlab/treesitter.py +0 -707
- mkdocstrings_matlab-0.9.7.dist-info/RECORD +0 -22
- {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/WHEEL +0 -0
- {mkdocstrings_matlab-0.9.7.dist-info → mkdocstrings_matlab-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
{#- Template for object attributes.
|
2
|
+
|
3
|
+
mathworks.com/help/matlab/matlab_oop/class-attributes.html
|
4
|
+
mathworks.com/help/matlab/matlab_oop/method-attributes.html
|
5
|
+
mathworks.com/help/matlab/matlab_oop/property-attributes.html
|
6
|
+
|
7
|
+
Context:
|
8
|
+
attributes (list): The list of attributes to render.
|
9
|
+
config (dict): The configuration options.
|
10
|
+
-#}
|
11
|
+
|
12
|
+
{% if config.show_attributes and attributes %}
|
13
|
+
{% block logs scoped %}
|
14
|
+
{#- Logging block.
|
15
|
+
|
16
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
17
|
+
-#}
|
18
|
+
{{ log.debug("Rendering attributes") }}
|
19
|
+
{% endblock logs %}
|
20
|
+
<span class="doc doc-attributes">
|
21
|
+
{% for attribute in attributes|sort %}
|
22
|
+
<small class="doc doc-attribute doc-attribute-{{ attribute }}"><code>{{ attribute }}</code></small>
|
23
|
+
{% endfor %}
|
24
|
+
</span>
|
25
|
+
{% endif %}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{#- Template for backlinks.
|
2
|
+
|
3
|
+
This template renders backlinks.
|
4
|
+
|
5
|
+
Context:
|
6
|
+
backlinks (Mapping[str, Iterable[str]]): The backlinks to render.
|
7
|
+
config (dict): The configuration options.
|
8
|
+
verbose_type (Mapping[str, str]): The verbose backlink types.
|
9
|
+
default_crumb (BacklinkCrumb): A default, empty crumb.
|
10
|
+
-#}
|
11
|
+
|
12
|
+
{% block logs scoped %}
|
13
|
+
{#- Logging block.
|
14
|
+
|
15
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
16
|
+
-#}
|
17
|
+
{% endblock logs %}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
{#- Template for members (children) of an object.
|
2
2
|
|
3
3
|
This template iterates on members of a given object and renders them.
|
4
|
-
It can group members by category (
|
4
|
+
It can group members by category (properties, classes, functions, scripts, namespaces) or render them in a flat list.
|
5
5
|
|
6
6
|
Context:
|
7
|
-
obj (
|
7
|
+
obj (mkdocstring_handlers.matlab.models.Object): The object to render.
|
8
8
|
config (dict): The configuration options.
|
9
9
|
root_members (bool): Whether the object is the root object.
|
10
10
|
heading_level (int): The HTML heading level to use.
|
@@ -13,7 +13,7 @@ Context:
|
|
13
13
|
{% if obj.all_members %}
|
14
14
|
{% block logs scoped %}
|
15
15
|
{#- Logging block.
|
16
|
-
|
16
|
+
|
17
17
|
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
18
18
|
-#}
|
19
19
|
{{ log.debug("Rendering children of " + obj.path) }}
|
@@ -37,21 +37,21 @@ Context:
|
|
37
37
|
{% set extra_level = 0 %}
|
38
38
|
{% endif %}
|
39
39
|
|
40
|
-
{% with
|
40
|
+
{% with properties = obj.properties|filter_objects(
|
41
41
|
filters=config.filters,
|
42
42
|
members_list=members_list,
|
43
43
|
inherited_members=config.inherited_members,
|
44
|
+
private_members=config.private_members,
|
45
|
+
hidden_members=config.hidden_members,
|
44
46
|
keep_no_docstrings=config.show_if_no_docstring,
|
45
47
|
) %}
|
46
|
-
{% if
|
48
|
+
{% if properties %}
|
47
49
|
{% if config.show_category_heading %}
|
48
50
|
{% filter heading(heading_level, id=html_id ~ "-properties") %}Properties{% endfilter %}
|
49
51
|
{% endif %}
|
50
52
|
{% with heading_level = heading_level + extra_level %}
|
51
|
-
{% for
|
52
|
-
{%
|
53
|
-
{% include attribute|get_template with context %}
|
54
|
-
{% endif %}
|
53
|
+
{% for property in properties|order_members(config.members_order, members_list) %}
|
54
|
+
{% include property|get_template %}
|
55
55
|
{% endfor %}
|
56
56
|
{% endwith %}
|
57
57
|
{% endif %}
|
@@ -61,6 +61,8 @@ Context:
|
|
61
61
|
filters=config.filters,
|
62
62
|
members_list=members_list,
|
63
63
|
inherited_members=config.inherited_members,
|
64
|
+
private_members=config.private_members,
|
65
|
+
hidden_members=config.hidden_members,
|
64
66
|
keep_no_docstrings=config.show_if_no_docstring,
|
65
67
|
) %}
|
66
68
|
{% if classes %}
|
@@ -69,9 +71,7 @@ Context:
|
|
69
71
|
{% endif %}
|
70
72
|
{% with heading_level = heading_level + extra_level %}
|
71
73
|
{% for class in classes|order_members(config.members_order, members_list) %}
|
72
|
-
{%
|
73
|
-
{% include class|get_template with context %}
|
74
|
-
{% endif %}
|
74
|
+
{% include class|get_template %}
|
75
75
|
{% endfor %}
|
76
76
|
{% endwith %}
|
77
77
|
{% endif %}
|
@@ -81,61 +81,64 @@ Context:
|
|
81
81
|
filters=config.filters,
|
82
82
|
members_list=members_list,
|
83
83
|
inherited_members=config.inherited_members,
|
84
|
+
private_members=config.private_members,
|
85
|
+
hidden_members=config.hidden_members,
|
84
86
|
keep_no_docstrings=config.show_if_no_docstring,
|
85
87
|
) %}
|
86
88
|
{% if functions %}
|
87
89
|
{% if config.show_category_heading %}
|
88
|
-
{%
|
90
|
+
{% if obj.is_class %}
|
91
|
+
{% filter heading(heading_level, id=html_id ~ "-methods") %}Methods{% endfilter %}
|
92
|
+
{% else %}
|
93
|
+
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
|
94
|
+
{% endif %}
|
89
95
|
{% endif %}
|
90
96
|
{% with heading_level = heading_level + extra_level %}
|
91
97
|
{% for function in functions|order_members(config.members_order, members_list) %}
|
92
|
-
{% if not (obj.kind.value == "class" and function.name ==
|
93
|
-
{%
|
94
|
-
{% include function|get_template with context %}
|
95
|
-
{% endif %}
|
98
|
+
{% if not (obj.kind.value == "class" and function.name == obj.name and config.merge_constructor_into_class) %}
|
99
|
+
{% include function|get_template %}
|
96
100
|
{% endif %}
|
97
101
|
{% endfor %}
|
98
102
|
{% endwith %}
|
99
103
|
{% endif %}
|
100
104
|
{% endwith %}
|
101
105
|
|
102
|
-
{%
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
{%
|
113
|
-
{% for script in scripts|order_members(config.members_order.alphabetical, members_list) %}
|
114
|
-
{% if members_list is not none or (not script.is_alias or script.is_public) %}
|
115
|
-
{% include script|get_template with context %}
|
116
|
-
{% endif %}
|
117
|
-
{% endfor %}
|
118
|
-
{% endwith %}
|
106
|
+
{% with scripts = obj.scripts|filter_objects(
|
107
|
+
filters=config.filters,
|
108
|
+
members_list=members_list,
|
109
|
+
inherited_members=config.inherited_members,
|
110
|
+
private_members=config.private_members,
|
111
|
+
hidden_members=config.hidden_members,
|
112
|
+
keep_no_docstrings=config.show_if_no_docstring,
|
113
|
+
) %}
|
114
|
+
{% if scripts %}
|
115
|
+
{% if config.show_category_heading %}
|
116
|
+
{% filter heading(heading_level, id=html_id ~ "-scripts") %}Scripts{% endfilter %}
|
119
117
|
{% endif %}
|
120
|
-
|
121
|
-
|
118
|
+
{% with heading_level = heading_level + extra_level %}
|
119
|
+
{% for script in scripts|order_members(config.members_order.alphabetical, members_list) %}
|
120
|
+
{% include script|get_template %}
|
121
|
+
{% endfor %}
|
122
|
+
{% endwith %}
|
123
|
+
{% endif %}
|
124
|
+
{% endwith %}
|
122
125
|
|
123
126
|
{% if config.show_subnamespaces or obj.is_folder %}
|
124
|
-
{% with
|
127
|
+
{% with namespaces = obj.namespaces|filter_objects(
|
125
128
|
filters=config.filters,
|
126
129
|
members_list=members_list,
|
127
130
|
inherited_members=config.inherited_members,
|
131
|
+
private_members=config.private_members,
|
132
|
+
hidden_members=config.hidden_members,
|
128
133
|
keep_no_docstrings=config.show_if_no_docstring,
|
129
134
|
) %}
|
130
|
-
{% if
|
135
|
+
{% if namespaces %}
|
131
136
|
{% if config.show_category_heading %}
|
132
|
-
{% filter heading(heading_level, id=html_id ~ "-namespaces") %}
|
137
|
+
{% filter heading(heading_level, id=html_id ~ "-namespaces") %}Namespaces{% endfilter %}
|
133
138
|
{% endif %}
|
134
139
|
{% with heading_level = heading_level + extra_level %}
|
135
|
-
{% for
|
136
|
-
{%
|
137
|
-
{% include module|get_template with context %}
|
138
|
-
{% endif %}
|
140
|
+
{% for namespace in namespaces|order_members("alphabetical", members_list) %}
|
141
|
+
{% include namespace|get_template %}
|
139
142
|
{% endfor %}
|
140
143
|
{% endwith %}
|
141
144
|
{% endif %}
|
@@ -151,35 +154,40 @@ Context:
|
|
151
154
|
filters=config.filters,
|
152
155
|
members_list=members_list,
|
153
156
|
inherited_members=config.inherited_members,
|
157
|
+
private_members=config.private_members,
|
158
|
+
hidden_members=config.hidden_members,
|
154
159
|
keep_no_docstrings=config.show_if_no_docstring,
|
155
160
|
)
|
156
161
|
|order_members(config.members_order, members_list)
|
157
162
|
%}
|
158
163
|
|
159
|
-
{% if not (obj.is_class and child.name ==
|
164
|
+
{% if not (config.merge_constructor_into_class and obj.is_class and child.is_function and child.name == obj.name) %}
|
160
165
|
|
161
|
-
{% if
|
162
|
-
{%
|
163
|
-
{%
|
164
|
-
|
165
|
-
{% endwith %}
|
166
|
+
{% if child.is_property %}
|
167
|
+
{% with property = child %}
|
168
|
+
{% include property|get_template %}
|
169
|
+
{% endwith %}
|
166
170
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
+
{% elif child.is_class %}
|
172
|
+
{% with class = child %}
|
173
|
+
{% include class|get_template %}
|
174
|
+
{% endwith %}
|
171
175
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
+
{% elif child.is_function %}
|
177
|
+
{% with function = child %}
|
178
|
+
{% include function|get_template %}
|
179
|
+
{% endwith %}
|
176
180
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
+
{% elif child.is_script %}
|
182
|
+
{% with script = child %}
|
183
|
+
{% include script|get_template %}
|
184
|
+
{% endwith %}
|
185
|
+
|
186
|
+
{% elif (child.is_namespace and config.show_subnamespaces) or obj.is_folder %}
|
187
|
+
{% with namespace = child %}
|
188
|
+
{% include namespace|get_template %}
|
189
|
+
{% endwith %}
|
181
190
|
|
182
|
-
{% endif %}
|
183
191
|
{% endif %}
|
184
192
|
|
185
193
|
{% endif %}
|
@@ -0,0 +1,236 @@
|
|
1
|
+
{#- Template for MATLAB classes.
|
2
|
+
|
3
|
+
This template renders a MATLAB class.
|
4
|
+
|
5
|
+
Context:
|
6
|
+
class (mkdocstrings_handlers.matlab.models.Class): The class to render.
|
7
|
+
root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
|
8
|
+
heading_level (int): The HTML heading level to use.
|
9
|
+
config (dict): The configuration options.
|
10
|
+
-#}
|
11
|
+
|
12
|
+
{% block logs scoped %}
|
13
|
+
{#- Logging block.
|
14
|
+
|
15
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
16
|
+
-#}
|
17
|
+
{{ log.debug("Rendering " + class.path) }}
|
18
|
+
{% endblock logs %}
|
19
|
+
|
20
|
+
<div class="doc doc-object doc-class">
|
21
|
+
{% with obj = class, html_id = class.path, all_members = class.all_members %}
|
22
|
+
|
23
|
+
{% if root %}
|
24
|
+
{% set show_full_path = config.show_root_full_path %}
|
25
|
+
{% set root_members = True %}
|
26
|
+
{% elif root_members %}
|
27
|
+
{% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
|
28
|
+
{% set root_members = False %}
|
29
|
+
{% else %}
|
30
|
+
{% set show_full_path = config.show_object_full_path %}
|
31
|
+
{% endif %}
|
32
|
+
|
33
|
+
{% set class_name = class.path if show_full_path else class.name %}
|
34
|
+
|
35
|
+
{% if not root or config.show_root_heading %}
|
36
|
+
{% filter heading(
|
37
|
+
heading_level,
|
38
|
+
role="class",
|
39
|
+
id=html_id,
|
40
|
+
class="doc doc-heading",
|
41
|
+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
|
42
|
+
) %}
|
43
|
+
|
44
|
+
{% block heading scoped %}
|
45
|
+
{#- Heading block.
|
46
|
+
|
47
|
+
This block renders the heading for the class.
|
48
|
+
-#}
|
49
|
+
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-class"></code>{% endif %}
|
50
|
+
{% if config.separate_signature %}
|
51
|
+
<span class="doc doc-object-name doc-class-name">{{ config.heading if config.heading and root else class_name }}</span>
|
52
|
+
{% elif config.merge_constructor_into_class and class_name in all_members %}
|
53
|
+
{% with function = all_members[class_name] %}
|
54
|
+
{%+ filter highlight(language="matlab", inline=True) -%}
|
55
|
+
{{ class_name }}{% include "signature.html.jinja" with context %}
|
56
|
+
{%- endfilter %}
|
57
|
+
{% endwith %}
|
58
|
+
{% else %}
|
59
|
+
<code>{{ class_name }}</code>
|
60
|
+
{% endif %}
|
61
|
+
{% endblock heading %}
|
62
|
+
|
63
|
+
{% block attributes scoped %}
|
64
|
+
{#- attributes block.
|
65
|
+
|
66
|
+
This block renders the attributes for the class.
|
67
|
+
-#}
|
68
|
+
{% with attributes = class.attributes %}
|
69
|
+
{% include "attributes.html.jinja" with context %}
|
70
|
+
{% endwith %}
|
71
|
+
{% endblock attributes %}
|
72
|
+
|
73
|
+
{% endfilter %}
|
74
|
+
|
75
|
+
{% block signature scoped %}
|
76
|
+
{#- Signature block.
|
77
|
+
|
78
|
+
This block renders the signature for the class.
|
79
|
+
Overloads of the constructor method are rendered if `merge_constructor_into_class` is enabled.
|
80
|
+
The actual constructor method signature is only rendered if `separate_signature` is also enabled.
|
81
|
+
-#}
|
82
|
+
{% if config.merge_constructor_into_class %}
|
83
|
+
{% if class.name in all_members %}
|
84
|
+
{% with function = all_members[class.name] %}
|
85
|
+
{% if function.overloads and config.show_overloads %}
|
86
|
+
<div class="doc-overloads">
|
87
|
+
{% for overload in function.overloads %}
|
88
|
+
{% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
|
89
|
+
{{ class.name }}
|
90
|
+
{% endfilter %}
|
91
|
+
{% endfor %}
|
92
|
+
</div>
|
93
|
+
{% endif %}
|
94
|
+
{% if config.separate_signature %}
|
95
|
+
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
|
96
|
+
{{ class.name }}
|
97
|
+
{% endfilter %}
|
98
|
+
{% endif %}
|
99
|
+
{% endwith %}
|
100
|
+
{% endif %}
|
101
|
+
{% endif %}
|
102
|
+
{% endblock signature %}
|
103
|
+
|
104
|
+
{% else %}
|
105
|
+
{% if config.show_root_toc_entry %}
|
106
|
+
{% filter heading(heading_level,
|
107
|
+
role="class",
|
108
|
+
id=html_id,
|
109
|
+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-class"></code> '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
|
110
|
+
hidden=True,
|
111
|
+
) %}
|
112
|
+
{% endfilter %}
|
113
|
+
{% endif %}
|
114
|
+
{% set heading_level = heading_level - 1 %}
|
115
|
+
{% endif %}
|
116
|
+
|
117
|
+
<div class="doc doc-contents {% if root %}first{% endif %}">
|
118
|
+
{% block contents scoped %}
|
119
|
+
{#- Contents block.
|
120
|
+
|
121
|
+
This block renders the contents of the class.
|
122
|
+
It contains other blocks that users can override.
|
123
|
+
Overriding the contents block allows to rearrange the order of the blocks.
|
124
|
+
-#}
|
125
|
+
{% block bases scoped %}
|
126
|
+
{#- Class bases block.
|
127
|
+
|
128
|
+
This block renders the bases for the class.
|
129
|
+
-#}
|
130
|
+
{% if config.show_bases and class.bases %}
|
131
|
+
<p class="doc doc-class-bases">
|
132
|
+
Bases: {% for expression in class.bases -%}
|
133
|
+
<code>
|
134
|
+
{%- with backlink_type = "subclassed-by" -%}
|
135
|
+
{%- include "expression.html.jinja" with context -%}
|
136
|
+
{%- endwith -%}
|
137
|
+
</code>{% if not loop.last %}, {% endif %}
|
138
|
+
{% endfor -%}
|
139
|
+
</p>
|
140
|
+
{% endif %}
|
141
|
+
{% endblock bases %}
|
142
|
+
|
143
|
+
{% block diagram scoped %}
|
144
|
+
|
145
|
+
{% endblock diagram %}
|
146
|
+
{# This block renders the inheritance diagram #}
|
147
|
+
{% if config.show_inheritance_diagram and class.bases %}
|
148
|
+
{% with section = class | as_inheritance_diagram_section %}
|
149
|
+
{{ section.value|convert_markdown(heading_level, html_id) }}
|
150
|
+
{% endwith %}
|
151
|
+
{% endif %}
|
152
|
+
{% block docstring scoped %}
|
153
|
+
{#- Docstring block.
|
154
|
+
|
155
|
+
This block renders the docstring for the class.
|
156
|
+
-#}
|
157
|
+
{% with docstring_sections = class.docstring.parsed %}
|
158
|
+
{% include "docstring.html.jinja" with context %}
|
159
|
+
{% endwith %}
|
160
|
+
{% if config.merge_constructor_into_class and class.constructor %}
|
161
|
+
{# We don't want to merge the inherited constructor method docstring into the class docstring #}
|
162
|
+
{# if such inherited method was not selected through `inherited_members`. #}
|
163
|
+
{% with check_members = all_members if (config.inherited_members is true or (config.inherited_members is iterable and class.constructor.name in config.inherited_members)) else class.members %}
|
164
|
+
{% if class.constructor.name in check_members and class.constructor.has_docstring %}
|
165
|
+
{% with function = class.constructor %}
|
166
|
+
{% with obj = function, docstring_sections = function | function_docstring(config.parse_arguments, config.show_docstring_input_arguments, config.show_docstring_name_value_arguments, config.show_docstring_output_arguments) %}
|
167
|
+
{% include "docstring.html.jinja" with context %}
|
168
|
+
{% endwith %}
|
169
|
+
{% endwith %}
|
170
|
+
{% endif %}
|
171
|
+
{% endwith %}
|
172
|
+
{% endif %}
|
173
|
+
{% endblock docstring %}
|
174
|
+
|
175
|
+
{% if config.backlinks %}
|
176
|
+
<backlinks identifier="{{ html_id }}" handler="python" />
|
177
|
+
{% endif %}
|
178
|
+
|
179
|
+
{% block summary scoped %}
|
180
|
+
{#- Summary block.
|
181
|
+
|
182
|
+
This block renders auto-summaries for classes, methods, and attributes.
|
183
|
+
-#}
|
184
|
+
{% include "summary.html.jinja" with context %}
|
185
|
+
{% endblock summary %}
|
186
|
+
|
187
|
+
{% block source scoped %}
|
188
|
+
{#- Source block.
|
189
|
+
|
190
|
+
This block renders the source code for the class.
|
191
|
+
-#}
|
192
|
+
{% if config.show_source %}
|
193
|
+
{% if config.merge_constructor_into_class %}
|
194
|
+
{% if class.constructor and class.constructor.source %}
|
195
|
+
{% with constructor = class.constructor %}
|
196
|
+
<details class="quote">
|
197
|
+
<summary>Source code in <code>
|
198
|
+
{%- if constructor.relative_filepath.is_absolute() -%}
|
199
|
+
{{ constructor.relative_package_filepath }}
|
200
|
+
{%- else -%}
|
201
|
+
{{ constructor.relative_filepath }}
|
202
|
+
{%- endif -%}
|
203
|
+
</code></summary>
|
204
|
+
{{ constructor.source|highlight(language="matlab", linestart=constructor.lineno or 0, linenums=True) }}
|
205
|
+
</details>
|
206
|
+
{% endwith %}
|
207
|
+
{% endif %}
|
208
|
+
{% elif class.source %}
|
209
|
+
<details class="quote">
|
210
|
+
<summary>Source code in <code>
|
211
|
+
{%- if class.relative_filepath.is_absolute() -%}
|
212
|
+
{{ class.relative_package_filepath }}
|
213
|
+
{%- else -%}
|
214
|
+
{{ class.relative_filepath }}
|
215
|
+
{%- endif -%}
|
216
|
+
</code></summary>
|
217
|
+
{{ class.source|highlight(language="matlab", linestart=class.lineno or 0, linenums=True) }}
|
218
|
+
</details>
|
219
|
+
{% endif %}
|
220
|
+
{% endif %}
|
221
|
+
{% endblock source %}
|
222
|
+
|
223
|
+
{% block children scoped %}
|
224
|
+
{#- Children block.
|
225
|
+
|
226
|
+
This block renders the children (members) of the class.
|
227
|
+
-#}
|
228
|
+
{% set root = False %}
|
229
|
+
{% set heading_level = heading_level + 1 %}
|
230
|
+
{% include "children.html.jinja" with context %}
|
231
|
+
{% endblock children %}
|
232
|
+
{% endblock contents %}
|
233
|
+
</div>
|
234
|
+
|
235
|
+
{% endwith %}
|
236
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{#- Template for admonitions in docstrings.
|
2
|
+
|
3
|
+
This template renders admonitions using the `details` HTML element.
|
4
|
+
|
5
|
+
Context:
|
6
|
+
section (griffe.DocstringSectionAdmonition): The section to render.
|
7
|
+
-#}
|
8
|
+
|
9
|
+
{% block logs scoped %}
|
10
|
+
{#- Logging block.
|
11
|
+
|
12
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
13
|
+
-#}
|
14
|
+
{{ log.debug("Rendering admonition") }}
|
15
|
+
{% endblock logs %}
|
16
|
+
|
17
|
+
<details class="{{ section.value.kind }}" open>
|
18
|
+
<summary>{{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True, autoref_hook=autoref_hook) }}</summary>
|
19
|
+
{{ section.value.contents|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
|
20
|
+
</details>
|
@@ -0,0 +1,85 @@
|
|
1
|
+
{#- Template for "Classes" sections in docstrings.
|
2
|
+
|
3
|
+
This template renders a list of documented classes in the format
|
4
|
+
specified with the [`docstring_section_style`][] configuration option.
|
5
|
+
|
6
|
+
Context:
|
7
|
+
section (griffe.DocstringSectionAttributes): The section to render.
|
8
|
+
-#}
|
9
|
+
|
10
|
+
{% block logs scoped %}
|
11
|
+
{#- Logging block.
|
12
|
+
|
13
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
14
|
+
-#}
|
15
|
+
{{ log.debug("Rendering classes section") }}
|
16
|
+
{% endblock logs %}
|
17
|
+
{% import "language.html.jinja" as lang with context %}
|
18
|
+
{#- Language module providing the `t` translation method. -#}
|
19
|
+
|
20
|
+
{% if config.docstring_section_style == "table" %}
|
21
|
+
{% block table_style scoped %}
|
22
|
+
{#- Block for the `table` section style. -#}
|
23
|
+
<p><span class="doc-section-title">{{ section.title or lang.t("Classes:") }}</span></p>
|
24
|
+
<table>
|
25
|
+
<thead>
|
26
|
+
<tr>
|
27
|
+
<th>{{ lang.t("Name") }}</th>
|
28
|
+
<th>{{ lang.t("Description") }}</th>
|
29
|
+
</tr>
|
30
|
+
</thead>
|
31
|
+
<tbody>
|
32
|
+
{% for class in section.value %}
|
33
|
+
<tr class="doc-section-item">
|
34
|
+
<td><code><autoref identifier="{{ obj.path }}.{{ class.name }}" optional hover>{{ class.name }}</autoref></code></td>
|
35
|
+
<td>
|
36
|
+
<div class="doc-md-description">
|
37
|
+
{{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
|
38
|
+
</div>
|
39
|
+
</td>
|
40
|
+
</tr>
|
41
|
+
{% endfor %}
|
42
|
+
</tbody>
|
43
|
+
</table>
|
44
|
+
{% endblock table_style %}
|
45
|
+
{% elif config.docstring_section_style == "list" %}
|
46
|
+
{% block list_style scoped %}
|
47
|
+
{#- Block for the `list` section style. -#}
|
48
|
+
<p><span class="doc-section-title">{{ section.title or lang.t("Classes:") }}</span></p>
|
49
|
+
<ul>
|
50
|
+
{% for class in section.value %}
|
51
|
+
<li class="doc-section-item field-body">
|
52
|
+
<b><code><autoref identifier="{{ obj.path }}.{{ class.name }}" optional hover>{{ class.name }}</autoref></code></b>
|
53
|
+
–
|
54
|
+
<div class="doc-md-description">
|
55
|
+
{{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
|
56
|
+
</div>
|
57
|
+
</li>
|
58
|
+
{% endfor %}
|
59
|
+
</ul>
|
60
|
+
{% endblock list_style %}
|
61
|
+
{% elif config.docstring_section_style == "spacy" %}
|
62
|
+
{% block spacy_style scoped %}
|
63
|
+
{#- Block for the `spacy` section style. -#}
|
64
|
+
<table>
|
65
|
+
<thead>
|
66
|
+
<tr>
|
67
|
+
<th><span class="doc-section-title">{{ (section.title or lang.t("CLASS")).rstrip(":").upper() }}</span></th>
|
68
|
+
<th><span>{{ lang.t("DESCRIPTION") }}</span></th>
|
69
|
+
</tr>
|
70
|
+
</thead>
|
71
|
+
<tbody>
|
72
|
+
{% for class in section.value %}
|
73
|
+
<tr class="doc-section-item">
|
74
|
+
<td><code><autoref identifier="{{ obj.path }}.{{ class.name }}" optional hover>{{ class.name }}</autoref></code></td>
|
75
|
+
<td class="doc-class-details">
|
76
|
+
<div class="doc-md-description">
|
77
|
+
{{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
|
78
|
+
</div>
|
79
|
+
</td>
|
80
|
+
</tr>
|
81
|
+
{% endfor %}
|
82
|
+
</tbody>
|
83
|
+
</table>
|
84
|
+
{% endblock spacy_style %}
|
85
|
+
{% endif %}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{#- Template for "Examples" sections in docstrings.
|
2
|
+
|
3
|
+
This template renders a list of documented examples.
|
4
|
+
It alternates between rendering text and code examples.
|
5
|
+
|
6
|
+
Context:
|
7
|
+
section (griffe.DocstringSectionAttributes): The section to render.
|
8
|
+
-#}
|
9
|
+
|
10
|
+
{% block logs scoped %}
|
11
|
+
{#- Logging block.
|
12
|
+
|
13
|
+
This block can be used to log debug messages, deprecation messages, warnings, etc.
|
14
|
+
-#}
|
15
|
+
{{ log.debug("Rendering examples section") }}
|
16
|
+
{% endblock logs %}
|
17
|
+
{% import "language.html.jinja" as lang with context %}
|
18
|
+
{#- Language module providing the `t` translation method. -#}
|
19
|
+
|
20
|
+
<p><span class="doc-section-title">{{ section.title or lang.t("Examples:") }}</span></p>
|
21
|
+
{% for section_type, sub_section in section.value %}
|
22
|
+
{% if section_type.value == "text" %}
|
23
|
+
{{ sub_section|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
|
24
|
+
{% elif section_type.value == "examples" %}
|
25
|
+
{{ sub_section|highlight(language="matlab") }}
|
26
|
+
{% endif %}
|
27
|
+
{% endfor %}
|