#[non_exhaustive]pub struct Document<'a> {
pub header: Option<Header<'a>>,
pub attributes: DocumentAttributes<'a>,
pub blocks: Vec<Block<'a>>,
pub footnotes: Vec<Footnote<'a>>,
pub toc_entries: Vec<TocEntry<'a>>,
pub references: HashMap<&'a str, Reference<'a>>,
pub location: Location,
}Expand description
A Document represents the root of an AsciiDoc document.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.header: Option<Header<'a>>§attributes: DocumentAttributes<'a>Effective end-of-header values. Later accepted changes are ordered
Block::DocumentAttribute nodes and do not update this snapshot.
blocks: Vec<Block<'a>>§footnotes: Vec<Footnote<'a>>§toc_entries: Vec<TocEntry<'a>>§references: HashMap<&'a str, Reference<'a>>Cross-reference targets keyed by id, for O(1) <<id>> resolution.
Covers sections, blocks, explicit inline anchors, and IDs on formatted
inline spans; collected during parsing. toc_entries remains the ordered
list used to render the table of contents. An empty key supplies the
document title or label when a reference addresses the document top.
Like toc_entries and
footnotes, this is not serialized.
location: LocationImplementations§
Source§impl Document<'_>
impl Document<'_>
Sourcepub fn renumber_sections(&mut self)
pub fn renumber_sections(&mut self)
Reassign section numbers from the current section tree.
Parsing does this automatically. Call it after changing the section tree or a section’s numbering policy. Existing cross-reference targets and table-of-contents entries receive the new numbers, but this method does not add, remove, or reorder those entries.
Automatic cross-references select the signifier for the target’s current
category from their original source-position attributes. Explicit
CrossReference::set_signifier overrides are preserved.
Sourcepub fn renumber_captions(&mut self)
pub fn renumber_captions(&mut self)
Reassign every automatic caption ordinal, numbering a block’s content before the block itself as asciidoctor does.
Parsing does this already. Call it after reordering or removing blocks, changing titles,
or inserting a block whose metadata.caption has been set. A caller-built block whose
metadata.caption is None stays unnumbered: nothing knows the document attributes at
a source position it never had, so a converter’s own fallback owns it.
Sourcepub fn highest_caption_number(&self, kind: CaptionKind) -> u32
pub fn highest_caption_number(&self, kind: CaptionKind) -> u32
The highest caption ordinal assigned to any block of kind, or 0 when none carries one.
A converter that renders a title the parser never numbered — one on a caller-built block, or added after parsing — should start its own counter here, so its numbers cannot collide with the parser’s.