Expand description
Lower #bibliography(...) directives into a semantic node.
This is the source boundary only (manifest ยง4, MVP 4): the directive
declares one bibliography database path, which is resolved relative to
the current .mos source file and stashed on a
[NodeKind::Bibliography] node. After lowering, citation keys are checked
against the parsed BibTeX records from those declared sources, resolved
citations get numeric [N] markers, and the first bibliography node
receives one rendered entry child per cited key in first-use order
(numeric slice only; CSL styles are a later slice).
Diagnostics:
MOS0040:#bibliography(...)called without a (non-empty) path.MOS0042:#bibliography(...)declared more than one path; first wins.MOS0020: the path argument is present but not a string.MOS0015: an unknown keyword argument was supplied.MOS0041: the resolved path does not point to a file on disk, or is not valid UTF-8 (a warning; the node is still emitted, withresolved_pathonly in the first case, so an unloadable source counts as incomplete).MOS0045: a citation key does not exist in a complete parsed bibliography set.MOS0046: a citation key appears in more than one declared bibliography source.
Structsยง
- Bibliography
Origin ๐ - Loaded
Bibliography ๐
Constantsยง
- BIBLIOGRAPHY_
KEYS ๐ - Named keys accepted by
bibliography_path; the MOS0015 nearest-match candidate set. Keep in sync with the match arms.
Functionsยง
- append_
bibliography_ ๐entries - Append one rendered entry per cited key as children of the first
[
NodeKind::Bibliography] node, ordered by first-use citation number. - bibliography_
path ๐ - Pull the single source path out of the directive arguments. A leading
positional string (
#bibliography("refs.bib")) or the namedpath:/src:forms are accepted, mirroring#image(...). ReturnsNone(after emitting a diagnostic) when the path is missing, empty, or not a string. - citation_
key_ ๐span - clean_
field ๐ - Strip BibTeX brace protection and collapse runs of whitespace, so field
values like
{The {TeX}book}render asThe TeXbook. - format_
entry ๐ - Render one BibTeX entry as plain text for the bibliography list.
- is_
citation_ ๐key - load_
bibliography ๐ - lower_
bibliography_ ๐directive - Lower
#bibliography("refs.bib")into a bibliography node. - nearest_
citation_ ๐key - The single loaded citation key that is a conservative near-miss for
unknown, if any. Candidate filtering stays here (is_citation_key); the selection rule (length floor,len / 3bound, ties suggest nothing) lives incrate::suggest::nearest_match. - resolve_
citations ๐ - Resolve citation keys against the already-loaded bibliography sources.