Cross-Reference roles only link to first instance

Anonymous avatarAnonymous created an issue

I have the following situation. I have a class promoted into Python using the Python/C API. This class has methods. Some of these methods are overloaded. In my documentation I have something like the following:

.. class:: MyClass

   This is my class.

   .. method run( Foo a ) -> string

   Run on a Foo object.

   .. method run( Bar b, Bug c ) -> string

   Run on Bar and Bug objects.

Now when I reference the methods there is no way to specify which one I want:

In order to run using a :class:`Foo` then use the :meth:`` method.

This will always resolve to the first class method. It seems that what is needed is an interface much like the ':ref:' role. Something where we can do the following:

:meth:` < Foo a )>`

Where the method signature can be provided and possibly the text that appears for the link.

Comments (1)

  1. Georg Brandl

    I think this is too involved for something that's very rarely needed for Python code, so I'll not change it.

    You could however write the docs a bit differently:

    .. method:: run(Foo a)
                run(Bar b)
       Docs for "the first form" and "the second form"...
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.