MCPcopy Create free account
hub / github.com/Qinbf/groundmap / slugify_cjk

Function slugify_cjk

scripts/build_tutorial_html.py:21–25  ·  view source on GitHub ↗

保留中文/字母/数字的 slug(默认 slugify 会把中文全部丢掉)。

(value: str, separator: str)

Source from the content-addressed store, hash-verified

19
20
21def slugify_cjk(value: str, separator: str) -> str:
22 """保留中文/字母/数字的 slug(默认 slugify 会把中文全部丢掉)。"""
23 value = value.strip().lower()
24 value = re.sub(r"[\s\W]+", separator, value, flags=re.UNICODE)
25 return value.strip(separator) or "section"
26
27
28def build() -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected