File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Print 'Hello world' to the terminal; test links in docstrings.
22
3- It is common in RST to use unnamed or anonymous links in text (like
4- `here <https://example.com/t-and-c/>`__ and `here
5- <https://example.org/co-op-rules.html>`__), but they should have two trailing
6- underscores!
7-
8- You *can* use a `single trailing underscore <https://example.com/links.html>`_
9- but it is treated as an implicitly named link. You can use the exact same link
10- text and URL again too (`single trailing underscore
11- <https://example.com/links.html>`_).
12-
13- However, the missing second underscore becomes a problem if the same link text
14- is used again for another implicitly named link with a *different* URL (e.g.
15- missing `single trailing underscore <https://example.com/bad.html>`_).
3+ Suppose we want to link to the Python_ home page, but have duplicate
4+ link targets defined?
165
176What happens here?
187
198 $ flake8 --select RST RST220/dup_explicit_target.py
20- RST220/dup_explicit_target.py:15:1: RST220 Duplicate explicit target name: "single trailing underscore".
9+ RST220/dup_explicit_target.py:3:1: RST399 Duplicate target name, cannot be used as a unique reference: "python".
10+ RST220/dup_explicit_target.py:15:1: RST220 Duplicate explicit target name: "python".
11+
12+ This file triggers an error as there are repeated conflicting definitions:
13+
14+ .. _Python: https://www.python.org
15+ .. _Python: https://python.org
2116
22- This file triggers an error when the implicitly named link is redefined.
2317""" # noqa: E501
2418
2519print ("Hello world" )
You can’t perform that action at this time.
0 commit comments