Assign the reference counts.

This commit is contained in:
Tom Alexander
2023-10-29 22:27:47 -04:00
parent ff03140007
commit 0da37b25e3
2 changed files with 20 additions and 9 deletions

View File

@@ -10,11 +10,11 @@ pub(crate) struct IFootnoteReference {
}
intermediate!(IFootnoteReference, FootnoteReference, original, registry, {
let footnote_id =
let (footnote_id, reference_count) =
get_footnote_reference_id(registry, original.label, &original.definition).await?;
Ok(IFootnoteReference {
footnote_id,
duplicate_offset: 0, // TODO
duplicate_offset: reference_count,
})
});
@@ -31,7 +31,7 @@ impl IFootnoteReference {
format!("fnr.{}", self.get_display_label())
} else {
// Org-mode makes all duplicates use "100" but I figure there is no harm in giving each a unique ID.
let append = 100 + self.duplicate_offset;
let append = 100 + self.duplicate_offset - 1;
format!("fnr.{}.{}", self.get_display_label(), append)
}
}