(value: str, max_len: int = 80)
| 40 | |
| 41 | |
| 42 | def _slug(value: str, max_len: int = 80) -> str: |
| 43 | text = re.sub(r"[^\w.\-]+", "-", str(value or "").strip(), flags=re.UNICODE) |
| 44 | text = re.sub(r"-{2,}", "-", text).strip("-._") |
| 45 | return (text or "paper")[:max_len] |
| 46 | |
| 47 | |
| 48 | def _paper_key(paper: Dict[str, Any]) -> str: |