I am documenting code in Sphinx that resembles this:
class ParentClass(object):def __init__(self):passdef generic_fun(self):"""Call this function using /run/ParentClass/generic_fun()"""do_stuff()class ChildClass(ParentClass):def specific_fun(self):"""Call this function using /run/ChildClass/specific_fun()"""do_other_stuff()
I added the :inherited-members
to the ChildClass
documentation, so I have statements in there like "Call this function using /run/ParentClass/generic_fun()".
Is there a way I can put something in the docstrings like <class_name> that Sphinx will replace with the actual class that it's documenting?
I would like to have the code look like:
class ParentClass(object):def __init__(self):passdef generic_fun(self):"""Call this function using /run/<class_name>/generic_fun()"""do_stuff()
So in the ChildClass section, the Sphinx documentation would read "(...) using /run/ChildClass/generic_fun()(...)" and the ParentClass section would read "(...) using /run/ParentClass/generic_fun()(...)"?
Ideally I'd like to have the documentation on the same page, so the replacement string would be different for different sections.