2016-11-26 44 views
-1

如何使两个链接在reStructuredText中具有相同的文本但具有不同的目标?下面的脚本不工作,但可以帮助你明白了吧:将相同的文本链接到reStructuredText中的不同目标

This Python_ is not the same as that Python_. 

.. _Python2: https://docs.python.org/2/ 
.. _Python3: https://docs.python.org/3/ 

此作业降价来完成:

This [Python][Python2] is not the same as that [Python][Python3]. 

[Python2]: https://docs.python.org/2/ 
[Python3]: https://docs.python.org/3/ 

结果:

Python是不一样的那Python

回答

1

更好的解决方案:

This `Python <Python2_>`_ is not the same as that `Python <Python3_>`_. 

.. _Python2: https://docs.python.org/2/ 
.. _Python3: https://docs.python.org/3/ 

实测值与指令和subsitutions的溶液。不知道这是否是最好的。

This |Python2|_ is not the same as that |Python3|_. 

.. |Python2| replace:: Python 
.. |Python3| replace:: Python 
.. _Python2: https://docs.python.org/2/ 
.. _Python3: https://docs.python.org/3/ 
相关问题