erynwells.me/scripts/erynwells_me/metadata.py

13 lines
283 B
Python
Raw Normal View History

#!/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