How to have the 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> 

Context is a list of publications in which I want them all to have a link labeled "DOI" at the end.

However, this seems to fail:

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

The exact error seems to depend on the version of docutils I am using, but they all failed.

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

+52
python restructuredtext
Mar 28 '11 at 20:20
source share
3 answers

Warning

(WARNING / 2) Duplicate explicit target name: foo

occurs when you use the same text for two different links in "Named Hyperlink Links":

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

To get around this, use anonymous hyperlink links with double underscores:

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

This works without warning on docutils 0.8.1.

+93
Dec 28 '12 at 9:59
source share

I think you will want to use anonymous hyperlinks:

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

Keep in mind that the order they refer to in the document is important. More information can be found here .

+12
Mar 28 '11 at 21:32
source share

It looks like you need a new line and two underscores.

This is what I do:

 What is that Process object good for? `(html) <process.html>`__ `(html) <other.process.rst>`__ 

To obtain:

 What is that Process object good for? <a class="reference external" href="process.html">(html)</a> <a class="reference external" href="process.rst">(html)</a> 
+3
Aug 01 '12 at 20:25
source share



All Articles