Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have same text in two links with restructured text?

Here is what I would like to do:

1. `link <http://www.google.com>`__ 2. `link <http://www.yahoo.com>`__ 

To obtain:

<ol> <li><a href="http://www.google.com">link</a></li> <li><a href="http://www.yahoo.com">link</a></li> </ol> 

The context is a list of publications, where I want them all to have a link marked "DOI" at the end.

However, this seems to fails with:

<string>:3: (WARNING/2) Duplicate explicit target name: "doi". 

The exact error seems to depend on the version of docutils that I use, but they've all failed.

Is there a way to generate multiple links with the same text in restructured text?

like image 877
luispedro Avatar asked Mar 28 '11 20:03

luispedro


People also ask

How do I comment a line in an RST file?

For comments, add 2 periods .. followed by a newline and then your comment indented.


1 Answers

The warning

(WARNING/2) Duplicate explicit target name:foo

occurs when you use the same text for two different links in "Named hyperlink references":

`Foo <http://example.org>`_ `Foo <http://example.com>`_ 

To circumvent it, use anonymous hyperlink references with double underscores:

`Foo <http://example.org>`__ `Foo <http://example.com>`__ 

This works without a warning on docutils 0.8.1.

like image 161
cweiske Avatar answered Sep 28 '22 11:09

cweiske