-1

How can I make two links have the same text but different targets in reStructuredText? The following script doesn't work but can help you get the point:

This Python_ is not the same as that Python_.

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

This job can be done in Markdown:

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

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

Result:

This Python is not the same as that Python.

Cyker
  • 9,946
  • 8
  • 65
  • 93

1 Answers1

2

A better solution:

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

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

Found a solution with directives and subsitutions. Not sure if this is the best.

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/
Cyker
  • 9,946
  • 8
  • 65
  • 93