normalize_doi#
- documenteer.citations.normalize_doi(value)#
Normalize a DOI into its bare form,
10.NNNN/suffix.- Parameters:
value (
str) – A DOI, either in its bare form or expressed as adoi.orgURL or with adoi:prefix. Whitespace around the DOI, and between a prefix and the DOI, is ignored.- Returns:
The bare DOI.
- Return type:
- Raises:
ValueError – Raised if the value is not a syntactically-valid DOI.
Notes
This is a reimplementation of
normalize_doiin thetechnotepackage (technote.metadata.doi, also re-exported fromtechnote.sources.tomlsettings), which validates a technote’s[technote] doifield. Documenteer repeats it so that user guides,documenteer technote sync-cff, and the technote linter — none of which goes through technote’s TOML model, and the last two of which run without thetechnoteextra installed — normalize DOIs the same way a technote build does.tests/test_citations.pyasserts the two agree whenevertechnoteis installed.