Is there any way to use substitutions to change the target of sphinx's autoclass function?

41 Views Asked by At

I'm documenting a method, and one of its parameters needs to be of a particular class. I therefore have the following code inside the method's docstring:

    .. autoclass:: mymodule.classnumberone
      :members:
      :exclude-members: Schema

This works fine. But the trouble is, I'm calling that same method through a variety of paths, and the class of the parameter changes depending on the path. One time it needs to be mymodule.classnumbertwo, mymodule.classnumberthree, etc.

I've tried each of the following but none of them work:

    .. autoclass:: mymodule.|classnumberone|
      :members:
      :exclude-members: Schema

and

    .. autoclass:: |moduleplusclass|
      :members:
      :exclude-members: Schema

and

    |entire autoclass directive|

and

    .. autoclass:: mymodule.classnumber|num|
      :members:
      :exclude-members: Schema

Each attempt, of course, is paired with the appropriate substitution directive on the pages that calls this method, such as .. |moduleplusclass| replace:: mymodule.classnumberone and .. |moduleplusclass| replace:: mymodule.classnumberone, or .. |entire autoclass directive| autoclass:: mymodule.classnumberone etc.

None of these work. It appears that it is resolving autoclass before it is resolving the substitution directive. Is there any way to accomplish what I'm trying to do here?

0

There are 0 best solutions below