Promote waiting footnote definitions.
This commit is contained in:
parent
613d49c6ec
commit
0ae492f8d3
@ -60,6 +60,10 @@ pub(crate) async fn get_footnote_reference_id<'orig, 'parse>(
|
||||
return Ok(pos);
|
||||
}
|
||||
|
||||
if let Some(label) = label {
|
||||
promote_footnote_definition(registry.clone(), label).await?;
|
||||
}
|
||||
|
||||
let existing_index = registry
|
||||
.lock()
|
||||
.unwrap()
|
||||
@ -147,3 +151,21 @@ async fn convert_definition_contents<'orig, 'parse>(
|
||||
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
/// Take a footnote definition that has not yet received a reference and move it into the active footnotes.
|
||||
pub(crate) async fn promote_footnote_definition<'orig, 'parse>(
|
||||
registry: RefRegistry<'orig, 'parse>,
|
||||
label: &'parse str,
|
||||
) -> Result<(), CustomError> {
|
||||
let definition = {
|
||||
let mut registry = registry.lock().unwrap();
|
||||
let definition = registry.on_deck_footnote_ids.remove(label);
|
||||
definition
|
||||
};
|
||||
if let Some(elements) = definition {
|
||||
let contents = convert_definition_contents(registry.clone(), elements).await?;
|
||||
let mut registry = registry.lock().unwrap();
|
||||
registry.footnote_ids.push((Some(label), contents));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user