ajustement tiret et apostrophe
This commit is contained in:
parent
f17e341a93
commit
21155e0517
1 changed files with 3 additions and 3 deletions
6
main.py
6
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:]}"
|
||||
|
|
Loading…
Add table
Reference in a new issue