Record on-deck footnote definitions.
This commit is contained in:
parent
0f7e5eea25
commit
613d49c6ec
@ -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<IAstNode>)>,
|
||||
_phantom: PhantomData<&'orig ()>,
|
||||
on_deck_footnote_ids: HashMap<&'parse str, &'orig Vec<Element<'parse>>>,
|
||||
}
|
||||
|
||||
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?;
|
||||
|
Loading…
Reference in New Issue
Block a user