4

例子:

foo is a tool used to do foo.

Download_

.. _Download: http://example.com/foo

blah blah blah (omit a lot of paragraphs)

bar is another tool to do bar.

Download_

.. _Download: http://example.com/bar

由于Download指向不同的 url,docutilus 给出了这个错误报告:

Duplicate target name, cannot be used as a
unique reference: "Download".

在 markdown 中,我可以为这两个指定不同的 id Download

[Download][download-foo]
[download-foo]: http://example.com/foo
[Download][download-bar]
[download-bar]: http://example.com/bar

如何在 reStructuredText 中做类似的事情?

4

2 回答 2

4

选项一

正如@mzjn 指出的,让目标名称更清晰:

`Download foo`_

.. _Download foo: http://example.com/foo

`Download bar`_

.. _Download bar: http://example.com/bar

选项二

docutils-user 邮件列表

使用匿名超链接:

Download__


__ http://example.com/foo


Download__

__ http://example.com/bar
于 2011-02-08T11:14:44.090 回答
1

据我从文档中可以看出,ReST 文档中的引用名称共享一个公共命名空间,因此它们必须是唯一的。我想不出比这更好的了:

foo is a tool used to do foo.

`Download foo`_

.. _Download foo: http://example.com/foo

blah blah blah (omit a lot of paragraphs)

bar is another tool to do bar.

`Download bar`_

.. _Download bar: http://example.com/bar
于 2011-02-07T17:55:56.933 回答