示例:
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
指向不同的网址,因此docutilus会提供此错误报告:
Duplicate target name, cannot be used as a
unique reference: "Download".
在降价时,我可以为这两个Download
指定不同的ID:
[Download][download-foo]
[download-foo]: http://example.com/foo
[Download][download-bar]
[download-bar]: http://example.com/bar
如何在reStructuredText中执行类似的操作?
答案 0 :(得分:5)
正如@mzjn指出的那样,让目标名称更清晰:
`Download foo`_
.. _Download foo: http://example.com/foo
`Download bar`_
.. _Download bar: http://example.com/bar
使用匿名超链接:
Download__
__ http://example.com/foo
Download__
__ http://example.com/bar
答案 1 :(得分:1)
据我所知the documentation,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