From 21155e051791575ada0360c101ad3f59ffc814f3 Mon Sep 17 00:00:00 2001 From: Francois Pelletier Date: Tue, 18 Apr 2023 10:11:57 -0400 Subject: [PATCH] ajustement tiret et apostrophe --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 8866aa3..60038e5 100644 --- a/main.py +++ b/main.py @@ -31,15 +31,15 @@ def only_alphanumerics(text): """ Detects if the text contains only alphanumerics. """ - return re.search(r"[^\w\'\-]", text) is None + return re.search(r"[^\w\-]", text) is None def make_bold_part(token): """ Makes bold text. """ - if (not only_alphanumerics(token)) or len(token) <= 2: - return token + if (not only_alphanumerics(token)) or len(token) <= 3: + return f"**{token[0]}**{token[1:]}" else: mid_token = round(len(token)/2) return f"**{token[0:mid_token]}**{token[mid_token:]}"