mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-19 21:24: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("-_")
|