2016-11-26 73 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/ 
相關問題