Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在两个链接中有相同的文本和重新构造的文本?_Python_Restructuredtext - Fatal编程技术网

Python 如何在两个链接中有相同的文本和重新构造的文本?

Python 如何在两个链接中有相同的文本和重新构造的文本?,python,restructuredtext,Python,Restructuredtext,以下是我想做的: 1. `link <http://www.google.com>`__ 2. `link <http://www.yahoo.com>`__ 1`链接`__ 2. `链接`__ 获得: <ol> <li><a href="http://www.google.com">link</a></li> <li><a href="http://www.yahoo.com">li

以下是我想做的:

1. `link <http://www.google.com>`__
2. `link <http://www.yahoo.com>`__
1`链接`__
2. `链接`__
获得:

<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".
    
    :3:(警告/2)重复显式目标名称:“doi”。
    
    确切的错误似乎取决于我使用的docutils版本,但它们都失败了


    有没有办法在重组文本中生成具有相同文本的多个链接?

    我想您应该使用匿名超链接:

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

    请记住,文档中引用的顺序很重要。可以找到更多信息。

    似乎需要换行符和两个下划线

    我就是这么做的:

    What is that Process object good for? `(html)
    <process.html>`__
    `(html) 
    <other.process.rst>`__
    
    这个过程对象有什么好处`(html)
    `__
    `(html)
    `__
    
    获得:

    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>
    
    这个过程对象有什么好处?
    
    警告

    (警告/2)重复的显式目标名称:foo

    在“命名超链接引用”中的两个不同链接使用相同文本时发生:

    `Foo`_
    `福`_
    
    要避免这种情况,请使用带双下划线的匿名:

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

    这在docutils 0.8.1上运行时没有警告。

    我认为只有在较新的版本上才是如此。我可以确认我现在得到了这个结果(可以说,这是更好的结果)。我接受这个新的答案。可能是重复的
    `Foo <http://example.org>`__
    `Foo <http://example.com>`__