Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r""" (and other string prefixes) removed from the end of docstrings #84

Open
panicgh opened this issue Feb 8, 2022 · 0 comments · May be fixed by #87
Open

r""" (and other string prefixes) removed from the end of docstrings #84

panicgh opened this issue Feb 8, 2022 · 0 comments · May be fixed by #87

Comments

@panicgh
Copy link

panicgh commented Feb 8, 2022

Description

doxypypy produces a wrong result if a doctstring ends with a typical string prefix for example r""":

Input:

def fun():
    """Simulator"""
    pass

Output, note doxypypy ate the r:

## @brief Simulato
def fun():
    pass

Testing other string prefixes. Affected: r u R U fr Fr fR FR

$ for i in r u R U f F fr Fr fR FR rf rF Rf RF; do py_filter <(cat <<<"\"\"\"$i = $i\"\"\""); done
## @brief r =
## @brief u =
## @brief R =
## @brief U =
## @brief f = f
## @brief F = F
## @brief fr = f
## @brief Fr = F
## @brief fR = f
## @brief FR = F
## @brief rf = rf
## @brief rF = rF
## @brief Rf = Rf
## @brief RF = RF

Workaround

Terminate all docstrings with .

Version

commit a739b12

panicgh added a commit to panicgh/doxypypy that referenced this issue Mar 2, 2022
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)
@panicgh panicgh linked a pull request Mar 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant