adsfolio.pdf.arxiv

Derive arXiv identifiers from PDF file and ADS metadata records.

adsfolio.pdf.arxiv.arxiv_id(record)[source]

Return the arXiv identifier of a file record, or an empty string.

Checks the arxiv, arxiv_id, identifier and doi fields, then the bibcode, then the file path. Any value that contains a DOI is used only if it is an arXiv DOI (10.48550/arXiv.<id>); other DOIs are skipped wherever they appear. New (2401.12345v2) and old-style (astro-ph/0601001) identifiers are recognized, as are legacy bibcodes such as 2024arXiv240112345B.

The file path is scanned for identifier-like text only, so a file name that looks like an arXiv identifier is reported as one.

Parameters:

record (collections.abc.Mapping[str, Any]) – File record with optional top-level fields and a metadata mapping.

Returns:

Identifier as found, including any version suffix.

Return type:

str

adsfolio.pdf.arxiv.normalize_arxiv_id(value)[source]

Return the version-free arXiv identifier in value, or an empty string.

Accepts a bare identifier, an arXiv: label, an arXiv DOI (10.48550/arXiv.<id>), or a legacy arXiv bibcode. Other DOIs give an empty string. The result identifies the paper across versions, for example 2401.12345v2 gives 2401.12345.

Parameters:

value (Any)

Return type:

str