MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / title_to_slug

Function title_to_slug

scripts/fix_missing_slugs.py:20–27  ·  view source on GitHub ↗

Generate slug from title or entry ID.

(title: str, eid: str)

Source from the content-addressed store, hash-verified

18
19
20def title_to_slug(title: str, eid: str) -> str:
21 """Generate slug from title or entry ID."""
22 h = hashlib.md5(eid.encode()).hexdigest()[:6]
23 clean = re.sub(r'[^\w\-]', '-', title[:30]).strip('-').lower()
24 clean = re.sub(r'-+', '-', clean)
25 if not clean:
26 clean = eid[:20]
27 return f"nmpa-gp-{clean}-{h}"
28
29
30def strip_year_revision(title: str) -> str:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected