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

Add a cache to rst.inline_markup_gen() #81

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sphinxlint/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- All constants are ALL_CAPS
- All compiled regexes are suffixed by _RE
"""
from functools import lru_cache

import regex as re

Expand Down Expand Up @@ -151,6 +152,7 @@
UNICODE_ALLOWED_AFTER_INLINE_MARKUP = r"\p{Pe}\p{Pi}\p{Pf}\p{Pd}\p{Po}"


@lru_cache(maxsize=None)
def inline_markup_gen(start_string, end_string, extra_allowed_before=""):
"""Generate a regex matching an inline markup.

Expand Down