sphinx-contrib/sphinx-lint

Improve regex to detect chars immediately after inline literals and roles

ezio-melotti opened this issue · 1 comments

From #27 (comment): some characters (such as punctuation) are allowed immediately after inline literals and roles, whereas others (alphanumerical) aren't.

The following regex could be improved to catch only the problematic characters:

for role in re.finditer("``.+?``(?!`).", paragraph_without_roles, flags=re.DOTALL):

Replacing the last . with \w seems to cause lot of false positives though.

I think this is now fixed, not because we enhanced the regex, but because all legitimate constructions are hidden from this detector via the paragraph = clean_paragraph(paragraph) call one line before the regex.

Don't hesitate to re-open if you have an example.