Alias causes "Duplicate explicit target name" when building docs

371 views
Skip to first unread message

Peleg Michaeli

unread,
Dec 1, 2016, 6:58:12 AM12/1/16
to sage-devel
I have a method, and in the docsrting of this method I have references. I then want to alias the method. Something like this:

    class Class(object):
        def method(self):
            r"""
            REFERENCES::

            .. [ABC123] A, B and C in 123, 123.
            """

        alias = method

This freaks sphinx out, and it warns:

    docstring of sage.......Class.method:123: WARNING: Duplicate explicit target name: "abc123".

Am I doing something wrong? Any better way of defining aliases?

I have followed the alias of adjacency_matrix (am) defined in generic_graph.py.


Thanks,
Peleg.

Dima Pasechnik

unread,
Dec 1, 2016, 7:47:28 AM12/1/16
to sage-devel
did you try "make doc-clean" and then rebuilding the docs?

Peleg Michaeli

unread,
Dec 1, 2016, 8:23:56 AM12/1/16
to sage-devel
Yes.

Peleg Michaeli

unread,
Dec 1, 2016, 8:26:18 AM12/1/16
to sage-devel
But perhaps I have to be more precise.

In the docstring I also have a link to the reference, something of the form [ABC123]_. I've read something about "anonymous links", but I am not sure I understood the difference. I keep searching.

Sébastien Labbé

unread,
Dec 1, 2016, 8:58:00 AM12/1/16
to sage-devel
$ cat file.rst

Cite many times the same item [ABCDEF]_ [ABCDEF]_ is okay.

.. [ABCDEF] bibliography

Many times the same item [XYZ]_ in bibliography in the same file is not okay.

.. [XYZ] bibliography1
.. [XYZ] bibliography2

labbe@priminfo tmp $ rst2html file.rst file.html
file.rst:9: (WARNING/2) Duplicate explicit target name: "xyz".
file.rst:6: (ERROR/3) Duplicate target name, cannot be used as a unique reference: "xyz".

Travis Scrimshaw

unread,
Dec 1, 2016, 9:35:55 AM12/1/16
to sage-devel
Hey Peleg,
   You should also only define the reference (i.e., the .. [XYZ] part) in the master references file in doc/en/reference/references/index.rst.

Best,
Travis

Peleg Michaeli

unread,
Dec 1, 2016, 10:20:25 AM12/1/16
to sage-devel
Hi Travis,

Thanks, I did not know that...
Reply all
Reply to author
Forward
0 new messages