Anonymous hyperlinks in restructuredtext

Sergio Spina sergio.am.spina at gmail.com
Sat May 28 08:28:20 EDT 2016


>From the "restructuredtext markup specification":

>    Anonymous hyperlink targets consist of an explicit markup
>    start (".. "), two underscores, a colon, whitespace, and a
>    link block; there is no reference name:
>
>        .. __: anonymous-hyperlink-target-link-block
>
>    An alternate syntax for anonymous hyperlinks consists of two
>    underscores, a space, and a link block:
>
>        __ anonymous-hyperlink-target-link-block

Ok. I got the file "test.rst"

==file test.rst==============

Nunc ante nulla, porttitor vitae massa eu, mollis tristique
urna. Duis bibendum arcu est, elementum.

.. __: link1

Curabitur sed ultrices ex. Integer.

.. __: link2

Quisque ornare mollis risus eu fringilla. Sed eros mauris,
auctor.

Now I put a reference to link1_ and another to link2_

==end of file=================

Let's try to pass it to docutils:

    $ rst2latex test.rst > tests.tex
      test.rst:11: (ERROR/3) Anonymous hyperlink mismatch: 0 references
        but 2 targets.
      See "backrefs" attribute for IDs.
      test.rst:10: (ERROR/3) Unknown target name: "link1".
      test.rst:10: (ERROR/3) Unknown target name: "link2".

Ok, I retry with the alternate syntax:

==file test.rst==============

Nunc ante nulla, porttitor vitae massa eu, mollis tristique
urna. Duis bibendum arcu est, elementum.

__ link1

Curabitur sed ultrices ex. Integer.

__ link2

Quisque ornare mollis risus eu fringilla. Sed eros mauris,
auctor.

Now I put a reference to link1_ and another to link2_

==end of file=================

Same error

    $ rst2latex test.rst > test.tex
      test.rst:14: (ERROR/3) Anonymous hyperlink mismatch: 0 references
        but 2 targets.
      See "backrefs" attribute for IDs.
      test.rst:13: (ERROR/3) Unknown target name: "link1".
      test.rst:13: (ERROR/3) Unknown target name: "link2".

Now, where is the error? How can I correctly set an internal
anonymous kyperlink?



More information about the Python-list mailing list