13 lines
283 B
Python
13 lines
283 B
Python
|
#!/usr/bin/env python3
|
||
|
# Eryn Wells <eryn@erynwells.me>
|
||
|
|
||
|
import re
|
||
|
|
||
|
|
||
|
def slugify(s: str) -> str:
|
||
|
'''Process a string into something suitable to be a page slug.'''
|
||
|
s = s.strip().lower()
|
||
|
s = re.sub(r'\s+', '-', s)
|
||
|
s = re.sub(r'[‘’“”"\'()]', '', s)
|
||
|
return s
|