pub struct Xnotes {
pub by_kind: BTreeMap<Name, Vec<XnoteRecord>>,
/* private fields */
}Expand description
The table of xnotes (XNOTES, flm.xnotes), which contains a record
(XnoteRecord) for each xnote of the document, grouped by xnote kind.
The collect stage COLLECT writes this table. It finds the xnotes in the
table of reference points (REFPOINTS). An xnote is a reference point
whose reference kind is the name of an xnote kind, immediately followed on
the same node by a reference point of the reference kind <kind>-mark.
The function ref_points returns these two reference
points. The xnotes that the elements of other features carry are therefore
recorded in the same way as the xnotes written with \footnote.
The records of each xnote kind are in document order, which is the order
of RefPoints::in_document_order. A node can carry several xnotes, of
one xnote kind or of several. Each xnote has a record of its own, and the
records of one node are in the order of its reference points.
Every xnote kind of the registry (every kind in the service slot
KINDS_SLOT) has an entry in by_kind. This entry is
empty if the document contains no xnote of the kind.
The table contains records only for the nodes of the document trees. A
node of a synthesized
value has no record.
When content is copied to be shown again, for instance the title of a
heading that a reference displays, each node that carries xnotes is
replaced in the copy by a MarkOf node. This node finds
the records of the original xnotes with
records_written_at.
The table also contains the content of the fixed mark of each unnumbered
xnote kind (fixed_mark). These marks are compiled
once, when the registry is built. The collect stage copies them into the
table so that the lowering rules, which have no access to the registry,
can read them.
Fields§
§by_kind: BTreeMap<Name, Vec<XnoteRecord>>The records of the xnotes, by the name of their xnote kind. The records of each kind are in document order.
Implementations§
Source§impl Xnotes
impl Xnotes
Sourcepub fn of_kind(&self, kind: &str) -> &[XnoteRecord]
pub fn of_kind(&self, kind: &str) -> &[XnoteRecord]
Returns the records of the xnote kind kind, in document order.
Returns an empty slice if the document contains no xnote of this kind,
and if kind is not the name of an xnote kind.
Sourcepub fn record_at(&self, addr: NodeAddr) -> Option<(&Name, &XnoteRecord)>
pub fn record_at(&self, addr: NodeAddr) -> Option<(&Name, &XnoteRecord)>
Returns the record of an xnote that the node at addr carries,
together with the name of its xnote kind. Returns None if the table
contains no record for this node: the node carries no xnote, or it is
not a node of a document tree.
If the node carries several xnotes, this method returns the first
record of the xnote kind whose name comes first in the order of the
names. To obtain the records of one xnote kind for a node, call
records_at.
Sourcepub fn records_at(
&self,
kind: &str,
addr: NodeAddr,
) -> impl Iterator<Item = &XnoteRecord>
pub fn records_at( &self, kind: &str, addr: NodeAddr, ) -> impl Iterator<Item = &XnoteRecord>
Returns the records of the xnotes of the kind kind that the node at
addr carries, in the order of the reference points of the node. The
first record belongs to the first xnote of this kind on the node, whose
content is the first region of this kind that the
XnoteSource aspect of the node returns, and so
on. Returns an empty iterator if the table contains no record of this
kind for the node.
Sourcepub fn records_written_at<'s>(
&'s self,
kind: &str,
span: &'s FlmSpan,
) -> impl Iterator<Item = &'s XnoteRecord>
pub fn records_written_at<'s>( &'s self, kind: &str, span: &'s FlmSpan, ) -> impl Iterator<Item = &'s XnoteRecord>
Returns the records of the xnote kind kind whose node was written at
span, in document order. A record matches if the span of its node
covers the same range of the same source as span. Returns an empty
iterator if no xnote of this kind was written at span.
Use this method to find the xnotes of a copied node. A copy of a node
keeps the span of the original node, but it has an address of its own,
for which the table contains no record. For instance, a
MarkOf node, which replaces a node that carries
xnotes in a copy of content shown again, finds the records of these
xnotes with this method.
Sourcepub fn fixed_mark(&self, kind: &str) -> &[Arc<NodeTree<Flm>>]
pub fn fixed_mark(&self, kind: &str) -> &[Arc<NodeTree<Flm>>]
Returns the content of the fixed mark of the unnumbered xnote kind
kind. The fixed mark is the mark template of the
kind, which contains no number and is therefore the same for every
xnote of the kind. It is compiled as FLM text when the registry is
built.
The content is a list of synthesized values, which a lowering rule
inserts into its output with
Lowerer::splice.
stage_mark_text writes the mark of an xnote
of any kind, numbered or not.
Returns an empty slice for a kind with an empty mark, for a numbered
kind, and if kind is not the name of an xnote kind of the registry.
Trait Implementations§
impl Eq for Xnotes
Source§impl SingletonTable for Xnotes
impl SingletonTable for Xnotes
Source§impl Table for Xnotes
impl Table for Xnotes
Source§fn absorb(&mut self, piece: Xnotes)
fn absorb(&mut self, piece: Xnotes)
Appends the records of piece after the records of self, kind by
kind. The fixed marks are the same in every table piece: if piece
has fixed marks, they replace those of self.
Source§fn project(&self, cx: &dyn ProjectCx) -> SerialValue
fn project(&self, cx: &dyn ProjectCx) -> SerialValue
Serializes the table as a map from the name of each xnote kind, in the
order of the names, to the list of its records, in document order.
Each record is a map with two keys: point, the key of the reference
point of the xnote, and mark, the key of the reference point of its
mark. A reference point has the key <node>#<index>, as in the
serialized table of reference points. The other fields of the records
and the fixed marks are not serialized.
Source§fn piece_class(&self) -> PieceClass
fn piece_class(&self) -> PieceClass
Auto Trait Implementations§
impl !RefUnwindSafe for Xnotes
impl !UnwindSafe for Xnotes
impl Forget for Xnotes
impl Freeze for Xnoteswhere
*const LeafNode<Name, Vec<XnoteRecord>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(Name, Vec<XnoteRecord>)>>: Freeze,
*const ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>> is !null: Freeze,
PhantomData<ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>>: Freeze,
impl Move for Xnotes
impl Send for Xnotes
impl Sync for Xnotes
impl Unpin for Xnotes
impl UnsafeUnpin for Xnoteswhere
*const LeafNode<Name, Vec<XnoteRecord>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(Name, Vec<XnoteRecord>)>>: UnsafeUnpin,
*const ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more