Skip to content

Commit

Permalink
Do not match string prefix at end of docstring
Browse files Browse the repository at this point in the history
The original docstring regex removed sequences such as `r"""` from a
docstring regardless if it appeared at the beginning or at the end of
the docstring: `r"""Simulator"""` erroneously becomes `Simulato`.
However, `r` etc. are
[string prefixes](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals)
and do not appear at the end of a string.

Therefore, this commit changes the regex to match string prefixes only
at the beginning of the docstring and not at the end.

(Closes Feneric#84)
  • Loading branch information
panicgh committed Mar 2, 2022
1 parent a739b12 commit 88cdeef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doxypypy/doxypypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class AstWalker(NodeVisitor):
__indentRE = regexpCompile(r'^(\s*)\S')
__newlineRE = regexpCompile(r'^#', MULTILINE)
__blanklineRE = regexpCompile(r'^\s*$')
__docstrMarkerRE = regexpCompile(r"\s*([uUbB]*[rR]?(['\"]{3}))")
__docstrMarkerRE = regexpCompile(r"^\s*([uUbB]*[rR]?(['\"]{3}))|"
r"\s*(['\"]{3})\s*$")
__docstrOneLineRE = regexpCompile(r"\s*[uUbB]*[rR]?(['\"]{3})(.+)\1")

__implementsRE = regexpCompile(r"^(\s*)(?:zope\.)?(?:interface\.)?"
Expand Down

0 comments on commit 88cdeef

Please sign in to comment.