2016-11-26 10 views
-1

reStructuredTextでは、2つのリンクが同じテキストを持っていてもターゲットは異なるようにするにはどうすればよいですか?次のスクリプトは動作しませんが、あなたはポイントを得るのを助けることができます。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/ 
関連する問題