Only parse footnote definitions if they target a reference that exists.
This commit is contained in:
parent
afe62de2b6
commit
2e7cfd5637
@ -99,6 +99,16 @@ pub(crate) async fn register_footnote_definition<'orig, 'parse>(
|
||||
label: &'parse str,
|
||||
definition: &'orig Vec<Element<'parse>>,
|
||||
) -> Result<(), CustomError> {
|
||||
let has_existing: bool = {
|
||||
let mut registry = registry.lock().unwrap();
|
||||
registry
|
||||
.footnote_ids
|
||||
.iter_mut()
|
||||
.any(|(id, _definition)| *id == Some(label))
|
||||
};
|
||||
if !has_existing {
|
||||
return Ok(());
|
||||
}
|
||||
let contents = convert_definition_contents(registry.clone(), definition).await?;
|
||||
let mut registry = registry.lock().unwrap();
|
||||
if let Some((_existing_id, existing_definition)) = registry
|
||||
|
Loading…
x
Reference in New Issue
Block a user