sphinx-autoapi/autoapi/utils.py
2016-06-09 15:44:30 -07:00

15 lines
344 B
Python

import unicodedata
import re
# From Django
def slugify(value):
"""
Converts to lowercase, removes non-word characters (alphanumerics and
underscores) and converts spaces to hyphens. Also strips leading and
trailing whitespace.
"""
value = re.sub('[^\w\s-]', '', value).strip()
return re.sub('[-\s]+', '-', value)