Strip common decorations from a user-supplied DOI string.
(raw: str)
| 34 | |
| 35 | |
| 36 | def _normalize_doi(raw: str) -> str: |
| 37 | """Strip common decorations from a user-supplied DOI string.""" |
| 38 | cleaned = raw.strip() |
| 39 | for prefix in ("https://doi.org/", "http://doi.org/", "doi:", "DOI:"): |
| 40 | if cleaned.startswith(prefix): |
| 41 | cleaned = cleaned[len(prefix) :] |
| 42 | break |
| 43 | return cleaned |
| 44 | |
| 45 | |
| 46 | def _parse_crossref_date(parts: list[list[int]] | None) -> datetime | None: |