sphinx-contrib / matlabdomain

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

Class methods with a dot show an underscore instead of dot in the documentation. #82

Closed dullin closed 5 years ago

dullin commented 5 years ago

I'm using a Property Get Method where the method declaration looks like : function out = get.PropertyName(obj)

When rendering the pdf of a method name with a dot, the documentation shows an underscore instead. The previous example would show as get_PropertyName.

joeced commented 5 years ago

Thanks for the report. Apparently, this is intentional. In https://github.com/sphinx-contrib/matlabdomain/blob/0bda53cd473381e19e7674df101f46fd074dc5a7/sphinxcontrib/mat_types.py#L956 set/get methods get the dot replaced with an underscore. It looks like it has something to do with name lookup. I'll see if I can change the behavior to the the proper dot.,

joeced commented 5 years ago

@dullin I have now investigated this, and actually I'm not sure if they should be documented. MATLAB does not show any documentation strings for get/set methods, and according to https://se.mathworks.com/matlabcentral/answers/411344-why-doesn-t-the-methods-command-display-set-property-and-get-property-methods-of-a-class-what, this is expected behavior.

So, the question is, if we should actually document them at all. I could add behavior to actually skip these methods. Do you have an opinion on this.

dullin commented 5 years ago

I think skipping them is actually the right call in this case. Any documentation that was in the get/set methods would just be relegated to the property description instead. That makes sense since, like it was put forward, the methods themselves aren't callable.

joeced commented 5 years ago

Fixed in https://github.com/sphinx-contrib/matlabdomain/releases/tag/0.5.0.