mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 05:04:27 +00:00
8 lines
214 B
Python
8 lines
214 B
Python
import re
|
|
import unicodedata
|
|
|
|
|
|
def slugify(text: str) -> str:
|
|
value = unicodedata.normalize("NFKC", text)
|
|
value = re.sub(r"[^\w\s-]", "", value.lower())
|
|
return re.sub(r"[-\s]+", "-", value).strip("-_")
|