From 7248a8f01a4a061e081c317b0ed868313878a606 Mon Sep 17 00:00:00 2001 From: Francois Pelletier Date: Tue, 18 Apr 2023 10:35:22 -0400 Subject: [PATCH] ajustement tiret et apostrophe --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 60038e5..07f87e0 100644 --- a/main.py +++ b/main.py @@ -38,8 +38,12 @@ def make_bold_part(token): """ Makes bold text. """ - if (not only_alphanumerics(token)) or len(token) <= 3: + if re.search(r"\'", token[0:3]): + return token + elif only_alphanumerics(token) and len(token) <= 3: return f"**{token[0]}**{token[1:]}" + elif (not only_alphanumerics(token)) and len(token) <= 3: + return token else: mid_token = round(len(token)/2) return f"**{token[0:mid_token]}**{token[mid_token:]}"