From 613d49c6ec1e592e3509546a8f630c046103a8dc Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 29 Oct 2023 21:50:51 -0400 Subject: [PATCH] Record on-deck footnote definitions. --- src/intermediate/registry.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/intermediate/registry.rs b/src/intermediate/registry.rs index b34d88b..05dac3a 100644 --- a/src/intermediate/registry.rs +++ b/src/intermediate/registry.rs @@ -1,12 +1,7 @@ -use std::collections::HashMap; -use std::marker::PhantomData; -use std::sync::Arc; -use std::sync::Mutex; - -// use super::ast_node::IntoIAstNode; use crate::error::CustomError; use organic::types::Element; use organic::types::Object; +use std::collections::HashMap; use super::ast_node::IAstNode; use super::ast_node::IntoIAstNode; @@ -18,7 +13,7 @@ pub(crate) struct Registry<'orig, 'parse> { id_counter: IdCounter, targets: HashMap<&'parse str, String>, footnote_ids: Vec<(Option<&'parse str>, Vec)>, - _phantom: PhantomData<&'orig ()>, + on_deck_footnote_ids: HashMap<&'parse str, &'orig Vec>>, } impl<'orig, 'parse> Registry<'orig, 'parse> { @@ -27,7 +22,7 @@ impl<'orig, 'parse> Registry<'orig, 'parse> { id_counter: 0, targets: HashMap::new(), footnote_ids: Vec::new(), - _phantom: PhantomData, + on_deck_footnote_ids: HashMap::new(), } } @@ -107,6 +102,8 @@ pub(crate) async fn register_footnote_definition<'orig, 'parse>( .any(|(id, _definition)| *id == Some(label)) }; if !has_existing { + let mut registry = registry.lock().unwrap(); + registry.on_deck_footnote_ids.insert(label, definition); return Ok(()); } let contents = convert_definition_contents(registry.clone(), definition).await?;