Skip to content

Commit

Permalink
Correct regex in sphinx.py: An empty line must separate the original …
Browse files Browse the repository at this point in the history
…docstring and the directive.
  • Loading branch information
tantale committed Jan 16, 2021
1 parent ab2c1bf commit 1c0abcd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deprecated/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def __call__(self, wrapped):
# -- get the docstring, normalize the trailing newlines
docstring = textwrap.dedent(wrapped.__doc__ or "")
if docstring:
docstring = re.sub(r"\n*$", "\n\n", docstring, flags=re.DOTALL)
# An empty line must separate the original docstring and the directive.
docstring = re.sub(r"\n+$", "", docstring, flags=re.DOTALL) + "\n\n"

# -- append the directive division to the docstring
docstring += "".join("{}\n".format(line) for line in div_lines)
Expand Down

0 comments on commit 1c0abcd

Please sign in to comment.