docs: conf.py: silence SyntaxWarning on js_splitter_code
PATCH 1/1 docs: conf.py: silence SyntaxWarning on js_splitter_code
From: Quentin Schulz <[email protected]>
The js_splitter_code string contains backslashes that Python tries to use as escape sequence but doesn't manage to, hence the following SyntaxWarning message:
documentation/conf.py:188: SyntaxWarning: invalid escape sequence '\p'
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu)
Considering that we want this to be sent verbatim to the JS, let's make this a raw string instead.
--- documentation/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
documentation/conf.py +1 -1
@@ -182,7 +182,7 @@ class DashFriendlySearchEnglish(SearchEnglish): # Accept words that can include hyphens _word_re = re.compile(r'[\w\-]+') - js_splitter_code = """ + js_splitter_code = r""" function splitQuery(query) { return query .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu)
---
base-commit: 406e8a8e30404c0538f5aa46f211540bae2b206b
change-id: 20250606-conf-syntax-warning-8593925b82b7
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
Antonin Godard
AppliedQuoted 8 lines · Quentin Schulz
The
js_splitter_codestring contains backslashes that Python tries to use as escape sequence but doesn't manage to, hence the following SyntaxWarning message:
documentation/conf.py:188: SyntaxWarning: invalid escape sequence '\p'
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu)[...]
Applied, thanks!
[1/1] docs: conf.py: silence SyntaxWarning on js_splitter_code
commit: c1056672ef45b197136eb8815728d426337a5901
Best regards,
Signature · 1 line
Antonin Godard <[email protected]>