mkdocstrings-matlab 0.8.2__tar.gz → 0.9.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/CHANGELOG.md +20 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/PKG-INFO +1 -1
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/mynamespace.md +8 -1
- mkdocstrings_matlab-0.9.1/docs/snippets/+mynamespace/myscript.m +4 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/headings.md +3 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/members.md +4 -5
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/pyproject.toml +1 -1
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/scripts/copy_and_update_python_templates.py +30 -1
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/collect.py +3 -3
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/enums.py +19 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/handler.py +1 -1
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/models.py +18 -8
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/children.html.jinja +21 -0
- mkdocstrings_matlab-0.9.1/src/mkdocstrings_handlers/matlab/templates/material/script.html.jinja +137 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/style.css +9 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/treesitter.py +12 -5
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/CODEOWNERS +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/workflows/docs.yaml +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/workflows/qualify.yaml +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/workflows/release.yaml +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/workflows/update-templates.yaml +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.gitignore +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.python-version +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.vscode/launch.json +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.vscode/settings.json +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/LICENSE +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/README.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/api.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/changelog.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/credits.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/debug.py +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/img/preview_dark.png +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/img/preview_light.png +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/index.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/license.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/logo.png +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/logo.svg +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/overrides/main.html +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/overrides/partials/toc-item.html +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/+submodule/Contents.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/+submodule/subfunction.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/aClass.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/do_something.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/module.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/readme.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/BaseClass.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/Contents.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/ThisClass.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/mymembers.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/this_function.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/classA.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/classB.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/readme.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/typed_function.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+undocumented/ClassWithoutDocstring.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+undocumented/function_with_docstring.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+undocumented/function_without_docstring.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+undocumented/undocumented.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/Class.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/OtherClass.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/Thing.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/do_output.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/do_something.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/do_varargin.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/myClass.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/myParent.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/myfunction.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/print_hello.m +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/stylesheets/extra.css +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/docstrings.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/general.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/signatures.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/docstrings/google.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/docstrings/numpy.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/docstrings/sphinx.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/index.md +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/logo.svg +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/mkdocs.yml +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/renovate.json +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/requirements.lock +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/__init__.py +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/py.typed +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/docstring/namespaces.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/docstring/properties.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/folder.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/property.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja +0 -0
- {mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/templates/material/summary.html.jinja +0 -0
@@ -1,6 +1,26 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
+
## v0.9.1 (2025-01-16)
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
- Config path resolve ([#52](https://github.com/watermarkhu/mkdocstrings-matlab/pull/52),
|
9
|
+
[`710832b`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/710832b12d6371d9f5bba5578c4e3a555fe8a38d))
|
10
|
+
|
11
|
+
|
12
|
+
## v0.9.0 (2025-01-16)
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
- Add supports for scripts ([#51](https://github.com/watermarkhu/mkdocstrings-matlab/pull/51),
|
17
|
+
[`ecefc80`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/ecefc801e730cf3ab1d5889ecbfc400af0591385))
|
18
|
+
|
19
|
+
* fix: script does not have kind * fix: tree-sitter query fixes * fix: do not check for property
|
20
|
+
SetAccess for private * feat: add support for scripts * doc: update namespace contents * fix:
|
21
|
+
select only the first comment block as docstring
|
22
|
+
|
23
|
+
|
4
24
|
## v0.8.2 (2025-01-14)
|
5
25
|
|
6
26
|
### Bug Fixes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/mynamespace.md
RENAMED
@@ -8,6 +8,7 @@
|
|
8
8
|
classA.m
|
9
9
|
classB.m
|
10
10
|
typed_function.m
|
11
|
+
myscript.m
|
11
12
|
```
|
12
13
|
|
13
14
|
=== ":material-file-code: `readme.md`"
|
@@ -32,4 +33,10 @@
|
|
32
33
|
|
33
34
|
```matlab
|
34
35
|
--8<-- "docs/snippets/+mynamespace/typed_function.m"
|
35
|
-
```
|
36
|
+
```
|
37
|
+
|
38
|
+
=== ":material-file-code: `myscript.m`"
|
39
|
+
|
40
|
+
```matlab
|
41
|
+
--8<-- "docs/snippets/+mynamespace/myscript.m"
|
42
|
+
```
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/headings.md
RENAMED
@@ -595,6 +595,7 @@ This option will prefix items in the ToC with
|
|
595
595
|
<code class="doc-symbol doc-symbol-function"></code>,
|
596
596
|
<code class="doc-symbol doc-symbol-method"></code>,
|
597
597
|
<code class="doc-symbol doc-symbol-class"></code>,
|
598
|
+
<code class="doc-symbol doc-symbol-script"></code>,
|
598
599
|
<code class="doc-symbol doc-symbol-namespace"></code> or.
|
599
600
|
<code class="doc-symbol doc-symbol-folder"></code> types.
|
600
601
|
See also [`show_symbol_type_heading`][show_symbol_type_heading].
|
@@ -621,6 +622,7 @@ plugins:
|
|
621
622
|
<ul style="list-style: none;">
|
622
623
|
<li><code class="doc-symbol doc-symbol-folder"></code> folder</li>
|
623
624
|
<li><code class="doc-symbol doc-symbol-namespace"></code> namespace</li>
|
625
|
+
<li><code class="doc-symbol doc-symbol-script"></code> script</li>
|
624
626
|
<li><code class="doc-symbol doc-symbol-function"></code> function</li>
|
625
627
|
<li><code class="doc-symbol doc-symbol-class"></code> Class
|
626
628
|
<ul style="list-style: none;">
|
@@ -635,6 +637,7 @@ plugins:
|
|
635
637
|
<ul style="list-style: none;">
|
636
638
|
<li>folder</li>
|
637
639
|
<li>namespace</li>
|
640
|
+
<li>script</li>
|
638
641
|
<li>function</li>
|
639
642
|
<li>Class
|
640
643
|
<ul style="list-style: none;">
|
@@ -169,16 +169,15 @@ To simplify the definition here, any property or method that do not have attribu
|
|
169
169
|
```mermaid
|
170
170
|
flowchart TD
|
171
171
|
a[Access=public]
|
172
|
-
|
172
|
+
ga[GetAccess=public]
|
173
173
|
|
174
174
|
public[not private member]
|
175
175
|
private[private member]
|
176
176
|
a -- yes --> public
|
177
177
|
a -- no --> private
|
178
|
-
a -- "not specified" -->
|
179
|
-
|
180
|
-
|
181
|
-
|
178
|
+
a -- "not specified" --> ga
|
179
|
+
ga -- no --> private
|
180
|
+
ga -- yes --> public
|
182
181
|
```
|
183
182
|
|
184
183
|
This takes precedence over [`members`][] and [`filters`][], and also applies for [`inherited_members`][]. This means that for any private member to be shown, `private_members` must be enabled, and further selection is possible via [`members`][] and [`filters`][]. Private members will be labeled with it access attribute setting, this can be disabled in [`show_labels`][].
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/scripts/copy_and_update_python_templates.py
RENAMED
@@ -112,7 +112,7 @@ copy_template(
|
|
112
112
|
)
|
113
113
|
|
114
114
|
## Copy children template
|
115
|
-
copy_template(
|
115
|
+
(targetFile, content) = copy_template(
|
116
116
|
"_base/children.html.jinja",
|
117
117
|
"children.html.jinja",
|
118
118
|
{
|
@@ -124,3 +124,32 @@ copy_template(
|
|
124
124
|
"{% elif child.is_module and config.show_submodules %}": "{% elif (child.is_namespace and config.show_subnamespaces) or obj.is_folder %}",
|
125
125
|
},
|
126
126
|
)
|
127
|
+
|
128
|
+
|
129
|
+
scripts = """{% if obj.is_module %}
|
130
|
+
{% with scripts = obj.scripts|filter_objects(
|
131
|
+
filters=config.filters,
|
132
|
+
members_list=members_list,
|
133
|
+
keep_no_docstrings=config.show_if_no_docstring,
|
134
|
+
) %}
|
135
|
+
{% if scripts %}
|
136
|
+
{% if config.show_category_heading %}
|
137
|
+
{% filter heading(heading_level, id=html_id ~ "-scripts") %}Scripts{% endfilter %}
|
138
|
+
{% endif %}
|
139
|
+
{% with heading_level = heading_level + extra_level %}
|
140
|
+
{% for script in scripts|order_members(config.members_order.alphabetical, members_list) %}
|
141
|
+
{% if members_list is not none or (not script.is_alias or script.is_public) %}
|
142
|
+
{% include script|get_template with context %}
|
143
|
+
{% endif %}
|
144
|
+
{% endfor %}
|
145
|
+
{% endwith %}
|
146
|
+
{% endif %}
|
147
|
+
{% endwith %}
|
148
|
+
{% endif %}
|
149
|
+
|
150
|
+
|
151
|
+
"""
|
152
|
+
|
153
|
+
index = content.find("{% if config.show_subnamespaces or obj.is_folder %}")
|
154
|
+
content = content[:index] + scripts[:-1] + content[index:]
|
155
|
+
targetFile.write_text(content)
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/collect.py
RENAMED
@@ -3,7 +3,7 @@
|
|
3
3
|
from collections import defaultdict, deque
|
4
4
|
from copy import copy, deepcopy
|
5
5
|
from pathlib import Path
|
6
|
-
from typing import Mapping, Sequence, Callable, TypeVar
|
6
|
+
from typing import Any, Mapping, Sequence, Callable, TypeVar
|
7
7
|
|
8
8
|
from _griffe.collections import LinesCollection as GLC, ModulesCollection
|
9
9
|
from _griffe.docstrings.models import (
|
@@ -716,9 +716,9 @@ class LazyModel:
|
|
716
716
|
parent = None
|
717
717
|
return parent
|
718
718
|
|
719
|
-
def _collect_path(self, path: Path) -> MatlabMixin:
|
719
|
+
def _collect_path(self, path: Path, **kwargs: Any) -> MatlabMixin:
|
720
720
|
file = FileParser(path)
|
721
|
-
model = file.parse(path_collection=self._path_collection)
|
721
|
+
model = file.parse(path_collection=self._path_collection, **kwargs)
|
722
722
|
self._lines_collection[path] = file.content.split("\n")
|
723
723
|
return model
|
724
724
|
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/enums.py
RENAMED
@@ -1,4 +1,23 @@
|
|
1
1
|
from enum import Enum
|
2
|
+
from _griffe.enumerations import Kind as GriffeKind
|
3
|
+
|
4
|
+
|
5
|
+
class Kind(str, Enum):
|
6
|
+
"""
|
7
|
+
An enumeration representing different kinds of MATLAB code elements.
|
8
|
+
This enumeration is a subclass of the Griffe `Kind` enumeration, and extends it with additional values.
|
9
|
+
"""
|
10
|
+
MODULE = "module"
|
11
|
+
"""Modules."""
|
12
|
+
CLASS = "class"
|
13
|
+
"""Classes."""
|
14
|
+
FUNCTION = "function"
|
15
|
+
"""Functions and methods."""
|
16
|
+
ATTRIBUTE = "attribute"
|
17
|
+
"""Attributes and properties."""
|
18
|
+
ALIAS = "alias"
|
19
|
+
"""Aliases (imported objects)."""
|
20
|
+
SCRIPT = "script"
|
2
21
|
|
3
22
|
|
4
23
|
class ParameterKind(str, Enum):
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/handler.py
RENAMED
@@ -193,7 +193,7 @@ class MatlabHandler(BaseHandler):
|
|
193
193
|
config_path = None
|
194
194
|
full_paths = []
|
195
195
|
else:
|
196
|
-
config_path = Path(config_file_path).parent
|
196
|
+
config_path = Path(config_file_path).resolve().parent
|
197
197
|
full_paths = [(config_path / path).resolve() for path in paths]
|
198
198
|
|
199
199
|
if pathIds := [str(path) for path in full_paths if not path.is_dir()]:
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/models.py
RENAMED
@@ -17,7 +17,7 @@ from griffe import (
|
|
17
17
|
Parameter as GriffeParameter,
|
18
18
|
)
|
19
19
|
|
20
|
-
from mkdocstrings_handlers.matlab.enums import AccessEnum, ParameterKind
|
20
|
+
from mkdocstrings_handlers.matlab.enums import Kind, AccessEnum, ParameterKind
|
21
21
|
|
22
22
|
if TYPE_CHECKING:
|
23
23
|
from mkdocstrings_handlers.matlab.collect import PathCollection
|
@@ -151,6 +151,14 @@ class MatlabObject(Object):
|
|
151
151
|
def namespaces(self) -> dict[str, "Namespace"]:
|
152
152
|
return {}
|
153
153
|
|
154
|
+
@property
|
155
|
+
def scripts(self) -> dict[str, "Script"]:
|
156
|
+
return {name: member for name, member in self.all_members.items() if member.kind is Kind.SCRIPT} # type: ignore[misc]
|
157
|
+
|
158
|
+
@property
|
159
|
+
def is_script(self) -> bool:
|
160
|
+
return False
|
161
|
+
|
154
162
|
@property
|
155
163
|
def is_namespace(self) -> bool:
|
156
164
|
return False
|
@@ -280,9 +288,15 @@ class Script(MatlabMixin, PathMixin, MatlabObject):
|
|
280
288
|
This class inherits from `PathMixin` and `MatlabObject` to provide
|
281
289
|
functionality specific to MATLAB scripts.
|
282
290
|
"""
|
291
|
+
kind = Kind.SCRIPT # type: ignore
|
283
292
|
|
284
|
-
|
293
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
294
|
+
super().__init__(*args, **kwargs)
|
295
|
+
self.extra["mkdocstrings"] = {"template": "script.html.jinja"}
|
285
296
|
|
297
|
+
@property
|
298
|
+
def is_script(self) -> bool:
|
299
|
+
return True
|
286
300
|
|
287
301
|
class Class(MatlabMixin, PathMixin, GriffeClass, MatlabObject):
|
288
302
|
"""
|
@@ -442,13 +456,9 @@ class Property(MatlabMixin, Attribute, MatlabObject):
|
|
442
456
|
@property
|
443
457
|
def Private(self) -> bool:
|
444
458
|
private = self.Access != AccessEnum.public
|
445
|
-
set_private = (
|
446
|
-
self.SetAccess != AccessEnum.public
|
447
|
-
and self.SetAccess != AccessEnum.immutable
|
448
|
-
)
|
449
459
|
get_private = self.GetAccess != AccessEnum.public
|
450
|
-
return private or
|
451
|
-
|
460
|
+
return private or get_private
|
461
|
+
|
452
462
|
@property
|
453
463
|
def is_private(self) -> bool:
|
454
464
|
return self.Private or self.Hidden
|
@@ -99,6 +99,27 @@ Context:
|
|
99
99
|
{% endif %}
|
100
100
|
{% endwith %}
|
101
101
|
|
102
|
+
{% if obj.is_module %}
|
103
|
+
{% with scripts = obj.scripts|filter_objects(
|
104
|
+
filters=config.filters,
|
105
|
+
members_list=members_list,
|
106
|
+
keep_no_docstrings=config.show_if_no_docstring,
|
107
|
+
) %}
|
108
|
+
{% if scripts %}
|
109
|
+
{% if config.show_category_heading %}
|
110
|
+
{% filter heading(heading_level, id=html_id ~ "-scripts") %}Scripts{% endfilter %}
|
111
|
+
{% endif %}
|
112
|
+
{% with heading_level = heading_level + extra_level %}
|
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 %}
|
119
|
+
{% endif %}
|
120
|
+
{% endwith %}
|
121
|
+
{% endif %}
|
122
|
+
|
102
123
|
{% if config.show_subnamespaces or obj.is_folder %}
|
103
124
|
{% with modules = obj.modules|filter_objects(
|
104
125
|
filters=config.filters,
|
mkdocstrings_matlab-0.9.1/src/mkdocstrings_handlers/matlab/templates/material/script.html.jinja
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
{#- Template for MATLAB scripts.
|
2
|
+
|
3
|
+
This template renders a MATLAB script.
|
4
|
+
|
5
|
+
Context:
|
6
|
+
script (mkdocstrings_handlers.matlab.models.Script): The Script 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 " + script.path) }}
|
18
|
+
{% endblock logs %}
|
19
|
+
|
20
|
+
<div class="doc doc-object doc-function">
|
21
|
+
{% with obj = script, html_id = script.path %}
|
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 script_name = script.path if show_full_path else script.name %}
|
34
|
+
|
35
|
+
{% if not root or config.show_root_heading %}
|
36
|
+
{% filter heading(
|
37
|
+
heading_level,
|
38
|
+
role="function",
|
39
|
+
id=html_id,
|
40
|
+
class="doc doc-heading",
|
41
|
+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-script"></code> '|safe if config.show_symbol_type_toc else '') + script.name,
|
42
|
+
) %}
|
43
|
+
|
44
|
+
{% block heading scoped %}
|
45
|
+
{#- Heading block.
|
46
|
+
|
47
|
+
This block renders the heading for the function.
|
48
|
+
-#}
|
49
|
+
{% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-script"></code>{% endif %}
|
50
|
+
{% if config.separate_signature %}
|
51
|
+
<span class="doc doc-object-name doc-function-name">{{ script_name }}</span>
|
52
|
+
{% else %}
|
53
|
+
{%+ filter highlight(language="matlab", inline=True) %}
|
54
|
+
{{ script_name }}
|
55
|
+
{% endfilter %}
|
56
|
+
{% endif %}
|
57
|
+
{% endblock heading %}
|
58
|
+
|
59
|
+
{% block labels scoped %}
|
60
|
+
{#- Labels block.
|
61
|
+
|
62
|
+
This block renders the labels for the script.
|
63
|
+
-#}
|
64
|
+
{% with labels = script.labels %}
|
65
|
+
{% include "labels"|get_template with context %}
|
66
|
+
{% endwith %}
|
67
|
+
{% endblock labels %}
|
68
|
+
|
69
|
+
{% endfilter %}
|
70
|
+
|
71
|
+
{% block signature scoped %}
|
72
|
+
{#- Signature block.
|
73
|
+
|
74
|
+
This block renders the signature for the script.
|
75
|
+
-#}
|
76
|
+
{% if config.separate_signature %}
|
77
|
+
{% filter format_signature(script, config.line_length, crossrefs=config.signature_crossrefs) %}
|
78
|
+
{{ script.name }}
|
79
|
+
{% endfilter %}
|
80
|
+
{% endif %}
|
81
|
+
{% endblock signature %}
|
82
|
+
|
83
|
+
{% else %}
|
84
|
+
|
85
|
+
{% if config.show_root_toc_entry %}
|
86
|
+
{% filter heading(heading_level,
|
87
|
+
role="function",
|
88
|
+
id=html_id,
|
89
|
+
toc_label=('<code class="doc-symbol doc-symbol-toc doc-symbol-script"></code> '|safe if config.show_symbol_type_toc else '') + script.name,
|
90
|
+
hidden=True,
|
91
|
+
) %}
|
92
|
+
{% endfilter %}
|
93
|
+
{% endif %}
|
94
|
+
{% set heading_level = heading_level - 1 %}
|
95
|
+
{% endif %}
|
96
|
+
|
97
|
+
<div class="doc doc-contents {% if root %}first{% endif %}">
|
98
|
+
{% block contents scoped %}
|
99
|
+
{#- Contents block.
|
100
|
+
|
101
|
+
This block renders the contents of the script.
|
102
|
+
It contains other blocks that users can override.
|
103
|
+
Overriding the contents block allows to rearrange the order of the blocks.
|
104
|
+
-#}
|
105
|
+
{% block docstring scoped %}
|
106
|
+
{#- Docstring block.
|
107
|
+
|
108
|
+
This block renders the docstring for the script.
|
109
|
+
-#}
|
110
|
+
{% with docstring_sections = script.docstring.parsed %}
|
111
|
+
{% include "docstring"|get_template with context %}
|
112
|
+
{% endwith %}
|
113
|
+
{% endblock docstring %}
|
114
|
+
|
115
|
+
{% block source scoped %}
|
116
|
+
{#- Source block.
|
117
|
+
|
118
|
+
This block renders the source code for the script.
|
119
|
+
-#}
|
120
|
+
{% if config.show_source and script.source %}
|
121
|
+
<details class="quote">
|
122
|
+
<summary>{{ lang.t("Source code in") }} <code>
|
123
|
+
{%- if script.relative_filepath.is_absolute() -%}
|
124
|
+
{{ script.relative_package_filepath }}
|
125
|
+
{%- else -%}
|
126
|
+
{{ script.relative_filepath }}
|
127
|
+
{%- endif -%}
|
128
|
+
</code></summary>
|
129
|
+
{{ script.source|highlight(language="python", linestart=script.lineno or 0, linenums=True) }}
|
130
|
+
</details>
|
131
|
+
{% endif %}
|
132
|
+
{% endblock source %}
|
133
|
+
{% endblock contents %}
|
134
|
+
</div>
|
135
|
+
|
136
|
+
{% endwith %}
|
137
|
+
</div>
|
@@ -46,7 +46,7 @@ FUNCTION_QUERY = LANGUAGE.query("""(function_definition .
|
|
46
46
|
[
|
47
47
|
(identifier) @output
|
48
48
|
(multioutput_variable .
|
49
|
-
((identifier) @output (",")?)
|
49
|
+
((identifier) @output (",")?)*
|
50
50
|
)
|
51
51
|
]
|
52
52
|
)? .
|
@@ -68,6 +68,7 @@ ARGUMENTS_QUERY = LANGUAGE.query("""(arguments_statement .
|
|
68
68
|
(attributes
|
69
69
|
(identifier) @attributes
|
70
70
|
)? .
|
71
|
+
(comment)? .
|
71
72
|
("\\n")? .
|
72
73
|
(property)+ @arguments
|
73
74
|
)""")
|
@@ -165,7 +166,7 @@ def _dedent(lines: list[str]) -> list[str]:
|
|
165
166
|
list[str]: A list of strings with the common leading whitespace removed from each line.
|
166
167
|
"""
|
167
168
|
indents = [len(line) - len(line.lstrip()) for line in lines if line.strip()]
|
168
|
-
indent = min(indents)
|
169
|
+
indent = min(indents) if indents else 0
|
169
170
|
if indent == 0:
|
170
171
|
return lines
|
171
172
|
else:
|
@@ -208,7 +209,7 @@ class FileParser(object):
|
|
208
209
|
"""
|
209
210
|
return self._content.decode(self.encoding)
|
210
211
|
|
211
|
-
def parse(self, **kwargs) -> MatlabMixin:
|
212
|
+
def parse(self, **kwargs: Any) -> MatlabMixin:
|
212
213
|
"""
|
213
214
|
Parse the content of the file and return a MatlabMixin.
|
214
215
|
|
@@ -246,7 +247,7 @@ class FileParser(object):
|
|
246
247
|
|
247
248
|
return model
|
248
249
|
|
249
|
-
def _parse_class(self, node: Node, **kwargs) -> Class:
|
250
|
+
def _parse_class(self, node: Node, **kwargs: Any) -> Class:
|
250
251
|
"""
|
251
252
|
Parse a class node and return a Class or Classfolder model.
|
252
253
|
|
@@ -412,7 +413,7 @@ class FileParser(object):
|
|
412
413
|
|
413
414
|
return (key, value)
|
414
415
|
|
415
|
-
def _parse_function(self, node: Node, method: bool = False, **kwargs) -> Function:
|
416
|
+
def _parse_function(self, node: Node, method: bool = False, **kwargs: Any) -> Function:
|
416
417
|
"""
|
417
418
|
Parse a function node and return a Function model.
|
418
419
|
|
@@ -592,6 +593,12 @@ class FileParser(object):
|
|
592
593
|
if nodes is None:
|
593
594
|
return None
|
594
595
|
elif isinstance(nodes, list):
|
596
|
+
|
597
|
+
# Ensure that if there is a gap between subsequent comment nodes, only the first block is considered
|
598
|
+
if gaps := (end.start_point.row - start.end_point.row for (start, end) in zip(nodes[:-1], nodes[1:])):
|
599
|
+
first_gap_index = next((i for i, gap in enumerate(gaps) if gap > 1), None)
|
600
|
+
nodes = nodes[:first_gap_index+1] if first_gap_index is not None else nodes
|
601
|
+
|
595
602
|
lineno = nodes[0].range.start_point.row + 1
|
596
603
|
endlineno = nodes[-1].range.end_point.row + 1
|
597
604
|
lines = iter(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/.github/workflows/update-templates.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/overrides/partials/toc-item.html
RENAMED
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/+submodule/Contents.m
RENAMED
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+module/do_something.m
RENAMED
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/BaseClass.m
RENAMED
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/ThisClass.m
RENAMED
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/mymembers.md
RENAMED
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mymembers/this_function.m
RENAMED
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/readme.md
RENAMED
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+mynamespace/typed_function.m
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/snippets/+undocumented/undocumented.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/docstrings.md
RENAMED
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/docs/usage/configuration/signatures.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/__init__.py
RENAMED
File without changes
|
{mkdocstrings_matlab-0.8.2 → mkdocstrings_matlab-0.9.1}/src/mkdocstrings_handlers/matlab/py.typed
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|