-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
kdeldycke/workflows
#397Labels
C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)Relates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documentedPEP 257 violation or existing functionality that doesn't work as documentedS: mergedClosed with work merged to repositoryClosed with work merged to repository
Milestone
Description
I've run into a couple issues related to formatting links in 1.5.1.
- Error with short link
To reproduce, create a file tmp.py containing:
"""
Test test.
See `the link <https://www.link.com>`_ for more details.
"""
Running docformatter tmp.py gives an error
...
File ".../lib/python3.9/site-packages/docformatter/syntax.py", line 272, in wrap_description
text = do_preserve_links(text, indentation, wrap_length)
File ".../lib/python3.9/site-packages/docformatter/syntax.py", line 82, in do_preserve_links
url = url + lines[url_idx + 1].strip()
IndexError: list index out of range
- Long links that get broken across lines also remove spaces from the text following the link
"""
Test test.
See `the link <https://www.link.com/a/long/link/that/causes/line/break>`_ for more details.
"""
Running docformatter tmp.py produces the output
--- before/tmp.py
+++ after/tmp.py
@@ -1,5 +1,6 @@
+"""Test test.
+
+See `the link
+
+<https://www.link.com/a/long/link/that/causes/line/break>`_ for moredetails.
"""
-Test test.
-
-See `the link <https://www.link.com/a/long/link/that/causes/line/break>`_ for more details.
-"""
Note that the space has been removed between "more" and "details".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)Relates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documentedPEP 257 violation or existing functionality that doesn't work as documentedS: mergedClosed with work merged to repositoryClosed with work merged to repository