MCPcopy Index your code
hub / github.com/vinta/awesome-python / slugify

Function slugify

website/readme_parser.py:54–60  ·  view source on GitHub ↗

Convert a category name to a URL-friendly slug.

(name: str)

Source from the content-addressed store, hash-verified

52
53
54def slugify(name: str) -> str:
55 """Convert a category name to a URL-friendly slug."""
56 slug = name.lower()
57 slug = _SLUG_NON_ALNUM_RE.sub("", slug)
58 slug = _SLUG_WHITESPACE_RE.sub("-", slug.strip())
59 slug = _SLUG_MULTI_DASH_RE.sub("-", slug)
60 return slug
61
62
63# --- Inline renderers -------------------------------------------------------

Callers 7

extract_entriesFunction · 0.90
test_simpleMethod · 0.90
test_hyphenated_inputMethod · 0.90
test_extra_spacesMethod · 0.90
_build_sectionFunction · 0.85
flush_groupFunction · 0.85

Calls

no outgoing calls

Tested by 4

test_simpleMethod · 0.72
test_hyphenated_inputMethod · 0.72
test_extra_spacesMethod · 0.72