Skip to main content

resolve_citations

Function resolve_citations 

Source
pub(crate) fn resolve_citations(
    document: &mut Document,
    diagnostics: &mut Vec<Diagnostic>,
) -> BTreeSet<String>
Expand description

Load every declared bibliography source, mark citation nodes whose keys exist in any parsed record set, and rewrite their visible text to a numeric label assigned by first-use order. Unknown citation keys emit MOS0045 once per citation node and keep their [?key?] placeholder.

Numbering is dense over known citations: a key consumes a number only when it resolves, and repeated uses of the same key reuse its first number. Unresolved keys never burn a slot, so [1], [2], … always index real bibliography records. This is the numeric-placeholder slice (issue #67), not full CSL: no author-year styles, sorted output, or citation clusters. Resolve [@key] citations and return the set of keys declared by the loaded bibliography sources. The reference resolver consumes that set to tell an @key label reference that misses the label index but matches a bibliography key apart – a near-certain “meant a citation” mistake – from a plain unknown label (see crate::resolve::resolve).