(base: str, seen: dict[str, int])
| 84 | |
| 85 | |
| 86 | def section_id(base: str, seen: dict[str, int]) -> str: |
| 87 | safe = re.sub(r"[^a-z0-9]+", "-", normalize_heading(base)).strip("-") or "section" |
| 88 | seen[safe] = seen.get(safe, 0) + 1 |
| 89 | suffix = "" if seen[safe] == 1 else f"-{seen[safe]}" |
| 90 | return f"sec:{safe}{suffix}" |
| 91 | |
| 92 | |
| 93 | def text_hash(text: str) -> str: |
no test coverage detected