-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Broader handling of glued roles. #61
Broader handling of glued roles. #61
Conversation
Previously only glued With this PR any character will trigger the rule. |
sphinxlint/checkers.py
Outdated
@@ -165,7 +165,10 @@ def check_missing_space_after_role(file, lines, options=None): | |||
# While this is not: | |||
# The :literal:`:exc:`Exceptions``s | |||
role_body = rf"([^`]|\s`+|\\`|:{rst.SIMPLENAME}:`([^`]|\s`+|\\`)+`)+" | |||
suspicious_role = re.compile(f":{rst.SIMPLENAME}:`{role_body}`s") | |||
allowed_after_role = " |" # '|' is allowed for roles in tables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't commas and other punctuation allowed too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I updated the list, does it looks better?
ASCII_ALLOWED_BEFORE_INLINE_MARKUP = r"""-:/'"<(\[{""" | ||
UNICODE_ALLOWED_BEFORE_INLINE_MARKUP = r"\p{Ps}\p{Pi}\p{Pf}\p{Pd}\p{Po}" | ||
ASCII_ALLOWED_AFTER_INLINE_MARKUP = r"""-.,:;!?/'")\]}>""" | ||
UNICODE_ALLOWED_AFTER_INLINE_MARKUP = r"\p{Pe}\p{Pi}\p{Pf}\p{Pd}\p{Po}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW all ASCII chars are technically already included in the Unicode categories, except for <>
which have an Sm
category. Even though they are redundant, I think it's ok since it's more explicit and it's easier to see what (ASCII) characters are allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this is a copy-paste from the spec: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules
I like copy-pasting from the spec.
Closes #60.