sphinx-contrib / matlabdomain

A Sphinx extension for documenting Matlab code
http://sphinxcontrib-matlabdomain.readthedocs.io/
Other
69 stars 45 forks source link

Class definitions with mustBeMember etc. #167

Closed eljistudios closed 1 year ago

eljistudios commented 1 year ago

Problem

In my code, I have a class with the following property definition:

classdef testClass
properties
    ReportLevel (1,1) string {mustBeMember(ReportLevel,["short","failed","full"])} = "full"
    prop2
end
end

From this, I obtain the following warning message using .. autoclass:::

WARNING: [sphinxcontrib-matlabdomain] Expected property in testClass - got (Token.Punctuation, '[')

and the documentation is not build for prop2. I assume that this issue persists for any code that is between the property name and the = sign, that contains [ or ].

Suggested Fix

I identified that adding two more lines after https://github.com/sphinx-contrib/matlabdomain/blob/9102348811ef49aec64a9a0829ed5ec34130b855/sphinxcontrib/mat_types.py#L532

            or self._tk_eq(idx, (Token.Punctuation, "["))
            or self._tk_eq(idx, (Token.Punctuation, "]"))

fixed the issue for me.

I would appreciate if someone would be so kind to check whether this is a reasonable change and introduce it into the repo.

joeced commented 1 year ago

Fixed in version 0.17.0