sphinx-contrib / matlabdomain

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

automethod does not work with methods defined in class folders #56

Closed joeced closed 1 year ago

joeced commented 6 years ago

For classes defined in class folders, @ClassFolder, methods defined in separate files in the folder need to use autofunction, rather than automethod. Further, the rendering is different.

For instance the classMethod must use .. autofunction:: classMethod and is rendered as

test_data.@ClassFolder.classMethod(obj, varargin)
...

Where the method_inside_class must use .. automethod:: ClassFolder.method_inside_classdef and is rendered as

ClassFolder.method_inside_classdef(a, b)
...
mikofski commented 6 years ago

bummer ☹️

joeced commented 6 years ago

@mikofski yeah :) ... I'll will look into it!

sehyoun commented 6 years ago

So this isn't a fundamental fix of this issue, but I have a workaround that I use for this case. The part that matter for me is the function/module signature. I usually try to get

some_name_I_want.function_name(var1,var2)

independent of the folder structure anyway. One can control this behavior by updating function of Documenter class of autodoc to introduce manual control of module, so I use

.. autofunction test_data.@ClassFolder.classMethod
    :module: some_name_I_want

I made the update in autodoc itself, but one could overload the in the documenter inherited in matlabdomain as well.

mikofski commented 6 years ago

Hi, so this was a hack I suppose rather than a bug or a feature. In other words, I was aware of this issue when I added class folders. See the test docs for class folders here they were rendered with the "@" symbol . And evidently I was also lazy about using automethod so the hack was to just use autofunction instead. You can see it here in the index rst file. Some times I just did the easiest thing to get it done. Sorry. But I think this shouldn't be to hard to clean up?