如何在两个带有重组文本的链接中拥有相同的文本?
这是我想做的:
1. `link <http://www.google.com>`__
2. `link <http://www.yahoo.com>`__
获取:
<ol>
<li><a href="http://www.google.com">link</a></li>
<li><a href="http://www.yahoo.com">link</a></li>
</ol>
上下文是出版物列表,我希望它们都在末尾有一个标记为“DOI”的链接。
但是,这似乎失败了:
<string>:3: (WARNING/2) Duplicate explicit target name: "doi".
确切的错误似乎取决于我使用的 docutils 版本,但它们都失败了。
有没有办法在重组文本中生成具有相同文本的多个链接?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
警告
当您对“命名超链接引用”中的两个不同链接使用相同文本时,会出现重复的显式目标名称:foo:
要规避它,请使用匿名 带双下划线的超链接引用:
这在 docutils 0.8.1 上有效,没有警告。
The warning
occurs when you use the same text for two different links in "Named hyperlink references":
To circumvent it, use anonymous hyperlink references with double underscores:
This works without a warning on docutils 0.8.1.
我认为您会想要使用匿名超链接:
请记住,它们在文档中引用的顺序很重要。更多信息可以在此处找到。
I think you'll want to use anonymous hyperlinks:
Keep in mind that the order they're referred to in the document is important. More information can be found here.
似乎您需要一个换行符和两个下划线。
这就是我所做的:
获得:
Seems like you need a newline and two underscores.
This is what I do:
to obtain: