pub struct Catalog { /* private fields */ }Expand description
Document catalog for tracking referenceable elements.
The catalog maintains a registry of all elements that can be referenced via cross-references, including anchors, sections, and bibliography entries. It provides functionality for registering new references, resolving reference text to IDs, and detecting duplicate IDs.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn get_ref(&self, id: &str) -> Option<&RefEntry>
pub fn get_ref(&self, id: &str) -> Option<&RefEntry>
Returns a reference entry by ID, if it exists.
Sourcepub fn contains_id(&self, id: &str) -> bool
pub fn contains_id(&self, id: &str) -> bool
Returns true if an ID is already registered in the catalog.
Sourcepub fn resolve_id(&self, reftext: &str) -> Option<String>
pub fn resolve_id(&self, reftext: &str) -> Option<String>
Resolve reference text to an ID, if possible.
Sourcepub fn ids(&self) -> impl Iterator<Item = &str>
pub fn ids(&self) -> impl Iterator<Item = &str>
Returns an iterator over all registered reference IDs, sorted by ID.
This lets a multi-document pipeline enumerate a document’s anchors and section IDs (for example, to build a global cross-reference index) without re-walking the block tree. The order is deterministic across process runs, so any output derived from it is reproducible.
Sourcepub fn footnotes(&self) -> &[Footnote]
pub fn footnotes(&self) -> &[Footnote]
Returns the footnotes registered in this document, in document order.
Sourcepub fn images(&self) -> &[ImageReference]
pub fn images(&self) -> &[ImageReference]
Returns the images referenced in this document, in document order.
This list is populated only when the parser was configured with
with_catalog_assets(true); it is
empty otherwise.
Sourcepub fn links(&self) -> &[String]
pub fn links(&self) -> &[String]
Returns the link targets referenced in this document, in document order.
This list is populated only when the parser was configured with
with_catalog_assets(true); it is
empty otherwise.
Sourcepub fn include_is_full(&self, key: &str) -> bool
pub fn include_is_full(&self, key: &str) -> bool
Returns true if the file named by key (an include target relative to
the outermost document, without its AsciiDoc extension) was included
into this document in full – i.e. at least one include::
directive merged the whole file, rather than only a lines/tag(s)
portion of it.
Returns false if the file was only ever partially included, or was not
included at all.
Sourcepub fn was_included(&self, key: &str) -> bool
pub fn was_included(&self, key: &str) -> bool
Returns true if the file named by key (an include target relative to
the outermost document, without its AsciiDoc extension) was included
into this document, whether in full or only partially.