diff mbox series

docs: conf.py: silence SyntaxWarning on js_splitter_code

Message ID 20250606-conf-syntax-warning-v1-1-4ebc90ae7d69@cherry.de
State Under Review
Headers show
Series docs: conf.py: silence SyntaxWarning on js_splitter_code | expand

Commit Message

Quentin Schulz June 6, 2025, 2:21 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

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.

Fixes: d4a98ee19e0c ("conf.py: tweak SearchEnglish to be hyphen-friendly")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 documentation/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 406e8a8e30404c0538f5aa46f211540bae2b206b
change-id: 20250606-conf-syntax-warning-8593925b82b7

Best regards,
diff mbox series

Patch

diff --git a/documentation/conf.py b/documentation/conf.py
index ad60d911394561f16dc28b3d41329f08e6c0999b..1eca8756abac72d311b39144f65910d28b4e3aec 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -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)