mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-08 07:10:31 +00:00
15 lines
344 B
Python
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)
|