Skip to main content

Module refs

Module refs 

Source
Expand description

Bibliography input adapters per ADR-0030.

Parses three input shapes into an iterator of Refs with optional entry_key provenance back to the source bibliography:

  • Plain refs: one doi:… / arxiv:… / bare-DOI / bare-arXiv id per line, with #-prefixed comments and blank lines tolerated. The existing doiget batch <refs.txt> shape.
  • CSL-JSON: a JSON array of entries with id (citation key), DOI, and optionally archivePrefix = "arXiv" + eprint fields. Parsed via the workspace’s existing serde_json — no new dependency.
  • BibTeX / BibLaTeX (.bib): deferred to a follow-up slice (the biblatex crate adds cargo-vet exemption churn that is independent of the slice 1 wire shape; users with a .bib library can re-export it as CSL-JSON from Zotero today).

Identifier-pick priority per ADR-0030 D3: doi > arxiv > pmid (PMID adapter parking until the Ref::Pmid variant lands in a later slice; current code carries the rule through without producing a Pmid ref).

Parse-error policy per ADR-0030 D5: a single entry’s failure is captured per-entry and does NOT abort the whole batch. The caller decides whether to skip-and-warn (default) or fail-closed (--strict).

Structs§

ParsedEntry
One successfully-parsed bibliography entry.

Enums§

Format
Input-shape discriminator per ADR-0030 D4.
ParseError
Why a single bibliography entry failed to produce a Ref.

Functions§

detect_format
Detect the input format per ADR-0030 D4.
parse_csl_json
Parse a CSL-JSON document — a JSON array of objects, each with at least an id (citation key) and one of DOI, or archivePrefix
parse_input
Parse text per format, dispatching to the matching shape parser. path is consulted only when format == Format::Auto to drive detect_format.
parse_plain_refs
Parse plain refs — the existing batch input format. One ref per non-blank, non-comment line. entry_key is always None for this shape; plain refs have no citation-key concept.