mkdocstrings-matlab 1.0.8__py3-none-any.whl → 1.0.10__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.
@@ -7,6 +7,7 @@ import sys
7
7
  from dataclasses import field, fields
8
8
  from typing import TYPE_CHECKING, Annotated, Any, Literal
9
9
 
10
+ from griffe._internal.docstrings.parsers import DocstringStyle
10
11
  from mkdocstrings import get_logger
11
12
 
12
13
  # YORE: EOL 3.10: Replace block with line 2.
@@ -358,12 +359,12 @@ class MatlabInputOptions:
358
359
  ] = "table"
359
360
 
360
361
  docstring_style: Annotated[
361
- Literal["google", "numpy", "sphinx"] | None,
362
+ DocstringStyle | None,
362
363
  Field(
363
364
  group="docstrings",
364
- description="The docstring style to use: `google`, `numpy`, `sphinx`, or `None`.",
365
+ description="The docstring style to use: `auto`, `google`, `numpy`, `sphinx`, or `None`.",
365
366
  ),
366
- ] = "google"
367
+ ] = "auto"
367
368
 
368
369
  parse_arguments: Annotated[
369
370
  bool,
@@ -169,6 +169,7 @@ class MatlabHandler(BaseHandler):
169
169
  self.env.filters["stash_crossref"] = rendering.do_stash_crossref
170
170
  self.env.filters["get_template"] = rendering.do_get_template
171
171
  self.env.filters["function_docstring"] = rendering.do_function_docstring
172
+ self.env.filters["parse_docstring"] = rendering.do_parse_docstring
172
173
  self.env.filters["as_properties_section"] = rendering.do_as_properties_section
173
174
  self.env.filters["as_functions_section"] = rendering.do_as_functions_section
174
175
  self.env.filters["as_classes_section"] = rendering.do_as_classes_section
@@ -14,6 +14,7 @@ from typing import TYPE_CHECKING, Any, Callable, ClassVar, Literal
14
14
  from griffe import (
15
15
  AliasResolutionError,
16
16
  CyclicAliasError,
17
+ Docstring,
17
18
  DocstringAttribute,
18
19
  DocstringClass,
19
20
  DocstringFunction,
@@ -32,6 +33,7 @@ from griffe._internal.docstrings.models import (
32
33
  DocstringSectionParameters,
33
34
  DocstringSectionReturns,
34
35
  )
36
+ from griffe._internal.docstrings.parsers import DocstringStyle, parse
35
37
  from jinja2 import pass_context
36
38
  from markupsafe import Markup
37
39
  from maxx.enums import ArgumentKind
@@ -612,17 +614,30 @@ def do_as_namespaces_section(
612
614
  )
613
615
 
614
616
 
617
+ def do_parse_docstring(
618
+ docstring: Docstring | None,
619
+ docstring_style: DocstringStyle,
620
+ docstring_options: dict[str, Any] | None,
621
+ ) -> list[DocstringSection]:
622
+ if docstring is None:
623
+ return []
624
+ options = docstring_options or {}
625
+ return parse(docstring, docstring_style, **options)
626
+
627
+
615
628
  def do_function_docstring(
616
629
  function: Function,
617
630
  parse_arguments: bool,
618
631
  show_docstring_input_arguments: bool,
619
632
  show_docstring_name_value_arguments: bool,
620
633
  show_docstring_output_arguments: bool,
634
+ docstring_style: DocstringStyle,
635
+ docstring_options: dict[str, Any] | None,
621
636
  ) -> list[DocstringSection]:
622
637
  if function.docstring is None:
623
638
  return []
624
639
 
625
- docstring_sections = [section for section in function.docstring.parsed]
640
+ docstring_sections = do_parse_docstring(function.docstring, docstring_style, docstring_options)
626
641
  if not parse_arguments or not (
627
642
  show_docstring_input_arguments
628
643
  or show_docstring_name_value_arguments
@@ -154,7 +154,7 @@ Context:
154
154
 
155
155
  This block renders the docstring for the class.
156
156
  -#}
157
- {% with docstring_sections = class.docstring.parsed %}
157
+ {% with docstring_sections = class.docstring | parse_docstring(config.docstring_style, config.docstring_options) %}
158
158
  {% include "docstring.html.jinja" with context %}
159
159
  {% endwith %}
160
160
  {% if config.merge_constructor_into_class and class.constructor %}
@@ -163,7 +163,7 @@ Context:
163
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
164
  {% if class.constructor.name in check_members and class.constructor.has_docstring %}
165
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) %}
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, config.docstring_style, config.docstring_options) %}
167
167
  {% include "docstring.html.jinja" with context %}
168
168
  {% endwith %}
169
169
  {% endwith %}
@@ -79,7 +79,7 @@ Context:
79
79
 
80
80
  This block renders the docstring for the folder.
81
81
  -#}
82
- {% with docstring_sections = folder.docstring.parsed %}
82
+ {% with docstring_sections = folder.docstring | parse_docstring(config.docstring_style, config.docstring_options) %}
83
83
  {% include "docstring.html.jinja" with context %}
84
84
  {% endwith %}
85
85
  {% endblock docstring %}
@@ -114,7 +114,7 @@ Context:
114
114
 
115
115
  This block renders the docstring for the function.
116
116
  -#}
117
- {% with docstring_sections = function | function_docstring(config.parse_arguments, config.show_docstring_input_arguments, config.show_docstring_name_value_arguments, config.show_docstring_output_arguments) %}
117
+ {% with docstring_sections = function | function_docstring(config.parse_arguments, config.show_docstring_input_arguments, config.show_docstring_name_value_arguments, config.show_docstring_output_arguments, config.docstring_style, config.docstring_options) %}
118
118
  {% include "docstring.html.jinja" with context %}
119
119
  {% endwith %}
120
120
  {% endblock docstring %}
@@ -82,7 +82,7 @@ Context:
82
82
 
83
83
  This block renders the docstring for the namespace.
84
84
  -#}
85
- {% with docstring_sections = namespace.docstring.parsed %}
85
+ {% with docstring_sections = namespace.docstring | parse_docstring(config.docstring_style, config.docstring_options) %}
86
86
  {% include "docstring.html.jinja" with context %}
87
87
  {% endwith %}
88
88
  {% endblock docstring %}
@@ -109,7 +109,7 @@ Context:
109
109
 
110
110
  This block renders the docstring for the property.
111
111
  -#}
112
- {% with docstring_sections = property.docstring.parsed %}
112
+ {% with docstring_sections = property.docstring | parse_docstring(config.docstring_style, config.docstring_options) %}
113
113
  {% include "docstring.html.jinja" with context %}
114
114
  {% endwith %}
115
115
  {% endblock docstring %}
@@ -85,7 +85,7 @@ Context:
85
85
 
86
86
  This block renders the docstring for the script.
87
87
  -#}
88
- {% with docstring_sections = script.docstring.parsed %}
88
+ {% with docstring_sections = script.docstring | parse_docstring(config.docstring_style, config.docstring_options) %}
89
89
  {% include "docstring.html.jinja" with context %}
90
90
  {% endwith %}
91
91
  {% endblock docstring %}
@@ -7,7 +7,7 @@
7
7
  -#}
8
8
  {% endblock logs %}
9
9
 
10
- {% if not obj.docstring.parsed | selectattr("kind.value", "eq", "classes") | list %}
10
+ {% if not obj.docstring | parse_docstring(config.docstring_style, config.docstring_options) | selectattr("kind.value", "eq", "classes") | list %}
11
11
  {% with section = obj.classes
12
12
  |filter_objects(
13
13
  filters=config.filters,
@@ -7,7 +7,7 @@
7
7
  -#}
8
8
  {% endblock logs %}
9
9
 
10
- {% if not obj.docstring.parsed | selectattr("kind.value", "eq", "functions") | list %}
10
+ {% if not obj.docstring | parse_docstring(config.docstring_style, config.docstring_options) | selectattr("kind.value", "eq", "functions") | list %}
11
11
  {% with section = obj.functions
12
12
  |filter_objects(
13
13
  filters=config.filters,
@@ -7,7 +7,7 @@
7
7
  -#}
8
8
  {% endblock logs %}
9
9
 
10
- {% if not obj.docstring.parsed | selectattr("kind.value", "eq", "modules") | list %}
10
+ {% if not obj.docstring | parse_docstring(config.docstring_style, config.docstring_options) | selectattr("kind.value", "eq", "modules") | list %}
11
11
  {% with section = obj.modules
12
12
  |filter_objects(
13
13
  filters=config.filters,
@@ -7,7 +7,7 @@
7
7
  -#}
8
8
  {% endblock logs %}
9
9
 
10
- {% if not obj.docstring.parsed | selectattr("kind.value", "eq", "properties") | list %}
10
+ {% if not obj.docstring | parse_docstring(config.docstring_style, config.docstring_options) | selectattr("kind.value", "eq", "properties") | list %}
11
11
  {% with section = obj.properties
12
12
  |filter_objects(
13
13
  filters=config.filters,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-matlab
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: A MATLAB handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: MIT
@@ -22,7 +22,7 @@ Classifier: Typing :: Typed
22
22
  Requires-Python: <3.14,>=3.10
23
23
  Requires-Dist: charset-normalizer~=3.4
24
24
  Requires-Dist: griffe~=1.14.0
25
- Requires-Dist: maxx~=0.4.2
25
+ Requires-Dist: maxx~=0.5.0
26
26
  Requires-Dist: mkdocs-autorefs~=1.4
27
27
  Requires-Dist: mkdocstrings~=0.29
28
28
  Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
@@ -1,20 +1,20 @@
1
1
  mkdocstrings_handlers/matlab/__init__.py,sha256=zLE8MANvIbg-pEVFc9bGhhIUvqAjnSANBGqek-dm3LM,1721
2
- mkdocstrings_handlers/matlab/config.py,sha256=LEv-tDlJrpKDz_g5cNKieCp3vlY1ZWTbWj2Y8RY0m8g,26708
3
- mkdocstrings_handlers/matlab/handler.py,sha256=ejp0w6ZplsdivdwbtiuTpt4nl58v0-ivn-bmH2UBDFc,9909
2
+ mkdocstrings_handlers/matlab/config.py,sha256=zpnTijfd21NTc_gIHSvzkOheUO4NTeNoaTyD62SIcNg,26755
3
+ mkdocstrings_handlers/matlab/handler.py,sha256=QUvqGlFaAvNVsxkjdh8y2xM7f7J-12vU351Ed9bItps,9984
4
4
  mkdocstrings_handlers/matlab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- mkdocstrings_handlers/matlab/rendering.py,sha256=yhxpyAcEkCCC6of84ENip5QhEheVNl16E5jNjB53iZs,25726
5
+ mkdocstrings_handlers/matlab/rendering.py,sha256=NhhgO7s6A64_s5U6Zg_wOFWHIzM3Alk6hO-so29zj7g,26227
6
6
  mkdocstrings_handlers/matlab/templates/material/attributes.html.jinja,sha256=3Wv9tRkBASmxW3NGdAw9V8mc7G6hc1pDIKmVQztlFJk,818
7
7
  mkdocstrings_handlers/matlab/templates/material/backlinks.html.jinja,sha256=FFrvIa-KH-DhT1cpc9HL0ecShR2gUVGs3VT9c1q88z8,467
8
8
  mkdocstrings_handlers/matlab/templates/material/children.html.jinja,sha256=gWV77R1BSkVlbQdY_VB9wrGSBY30bcm23skPTfOW1Fs,7517
9
- mkdocstrings_handlers/matlab/templates/material/class.html.jinja,sha256=vcTCQ9Q5WRLiT6t8mMKopGSQCfmJpnI678kCBxNWmak,9706
9
+ mkdocstrings_handlers/matlab/templates/material/class.html.jinja,sha256=cF4MbUEjlqK0p7LpKozRJyb3ULHVtXDl5VVDO83VSnE,9817
10
10
  mkdocstrings_handlers/matlab/templates/material/docstring.html.jinja,sha256=lpdQelVsBwBi0jpO1xCqX-59SmFZ7N269JCNhiae6Pc,2666
11
11
  mkdocstrings_handlers/matlab/templates/material/expression.html.jinja,sha256=3srDE2lRULPYAo7PFvy0tMT-2FKo2r6yE8Dvtui1HMI,1921
12
- mkdocstrings_handlers/matlab/templates/material/folder.html.jinja,sha256=wdr9Mte9cFy_dKbpCnWN2UPreZEZo5EHG23bEHwMd9M,4004
13
- mkdocstrings_handlers/matlab/templates/material/function.html.jinja,sha256=xJ6E06q9vxHaOxK2cRzP1DvoWqWOCO1NIME7j64dsf8,5659
12
+ mkdocstrings_handlers/matlab/templates/material/folder.html.jinja,sha256=b5fzUclu95-5vVwr6row8Y3GJUJWaxw2e7EU8kPlXM8,4065
13
+ mkdocstrings_handlers/matlab/templates/material/function.html.jinja,sha256=sPiTAknccAhHm0mbJYGcnmjGpQswDCHgzyAZ0DBYaVU,5709
14
14
  mkdocstrings_handlers/matlab/templates/material/language.html.jinja,sha256=7gyknTiapqCM8TjUHdXkQgZMmYwcuy6Ze0pkntE7g8s,617
15
- mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja,sha256=oS8Hiy_BWRRw-Xf-r3Mvi7H3egR7YlKms8bIHk_ocw0,4107
16
- mkdocstrings_handlers/matlab/templates/material/property.html.jinja,sha256=qS3WyTyhMH5c40TukESjVRirYybGoyhNys4kECegR3I,4579
17
- mkdocstrings_handlers/matlab/templates/material/script.html.jinja,sha256=doIFI-HiOAqBmSP3RhUsHlE-Djk2xE-MrModxWLM-VQ,4040
15
+ mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja,sha256=AuxgTGzPdXAnjR8Vly19Wh1eHdkR4c_3HVeljHKgk3Y,4168
16
+ mkdocstrings_handlers/matlab/templates/material/property.html.jinja,sha256=yTnaXkGZVsy0rip388yeJJxtta21ImTDY8OjfOej5n8,4640
17
+ mkdocstrings_handlers/matlab/templates/material/script.html.jinja,sha256=7KdPbjSKCVBnSwhmHoYfMT8ub4Wvp1dc2Xg_7HJb2bU,4101
18
18
  mkdocstrings_handlers/matlab/templates/material/signature.html.jinja,sha256=2J0XcBlTEGbC-UKCqoMbVmstAKMgszzGyZAIovhDSW0,3946
19
19
  mkdocstrings_handlers/matlab/templates/material/style.css,sha256=UgaVpWNzrTNzt_19wH0ryVAhs1GJ5eYK4JKJMHT4h2k,5083
20
20
  mkdocstrings_handlers/matlab/templates/material/summary.html.jinja,sha256=NgPQG1FeujVPJc6ePB1lRx7ovMuHqPkkSDVYPXoDWmA,725
@@ -30,11 +30,11 @@ mkdocstrings_handlers/matlab/templates/material/docstring/properties.html.jinja,
30
30
  mkdocstrings_handlers/matlab/templates/material/languages/en.html.jinja,sha256=Oen9OTX26S-RfcGYkRQr-FVoIYo1jWpK47UB_47l6S0,1042
31
31
  mkdocstrings_handlers/matlab/templates/material/languages/ja.html.jinja,sha256=Urtwz_zgo4ij3SkThxuaCS3x0eLqD0ScejocX-wgWVs,1131
32
32
  mkdocstrings_handlers/matlab/templates/material/languages/zh.html.jinja,sha256=qV2S8ikiE1C3TBqwRvKGvAnNtWGqDLn9j_NCOmFi95E,999
33
- mkdocstrings_handlers/matlab/templates/material/summary/classes.html.jinja,sha256=JuPeZVFHUF398Dw_E-HWoDKlCGFgj52B4W2YJosU4pA,842
34
- mkdocstrings_handlers/matlab/templates/material/summary/functions.html.jinja,sha256=f19-RvEkHZO4VegiQApq71nAEA27RKwQW3S2NMmKrW4,860
35
- mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja,sha256=J0aPYlktc5RY3Gax6GCZDxT5qgFDB5b3eqZZXfZOHxU,845
36
- mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja,sha256=0wQeDtZzfLSZPHJzLG_MVzre1NSyoSHowTwYzk0JX1c,857
37
- mkdocstrings_matlab-1.0.8.dist-info/METADATA,sha256=20c9N9u40rHEqCtm7j-qNsk0yr2XdERHLhJBOnQ4xgo,4616
38
- mkdocstrings_matlab-1.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- mkdocstrings_matlab-1.0.8.dist-info/licenses/LICENSE,sha256=TZQpwBuA3KLH56--XDAY2Qwo9gGdxeTITYhMOylmYhg,743
40
- mkdocstrings_matlab-1.0.8.dist-info/RECORD,,
33
+ mkdocstrings_handlers/matlab/templates/material/summary/classes.html.jinja,sha256=eALUVZq6MDLZmtaLD_Y9029eQQbFdtHxGKDe44FDWMI,903
34
+ mkdocstrings_handlers/matlab/templates/material/summary/functions.html.jinja,sha256=IhcY4O2HeGYjUjNQ9W9aYiNecCjrTzNVQopgRzxHtz8,921
35
+ mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja,sha256=fWuFO5a2P-OEky2wvv95XLtB-9PTkymFC9MIQ5XS6FE,906
36
+ mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja,sha256=lgVn15U3mg72RjmgvZxCqrRsjx2eEyZ0HM0bt1LxWMM,918
37
+ mkdocstrings_matlab-1.0.10.dist-info/METADATA,sha256=r7pY3Y6pVsj1jVpfhSURjThcOPaKoOvgvqascR5LJt0,4617
38
+ mkdocstrings_matlab-1.0.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
+ mkdocstrings_matlab-1.0.10.dist-info/licenses/LICENSE,sha256=TZQpwBuA3KLH56--XDAY2Qwo9gGdxeTITYhMOylmYhg,743
40
+ mkdocstrings_matlab-1.0.10.dist-info/RECORD,,