Add support for target links.
This commit is contained in:
@@ -14,7 +14,7 @@ type IdCounter = u16;
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Registry<'orig, 'parse> {
|
||||
id_counter: IdCounter,
|
||||
targets: HashMap<&'parse str, String>,
|
||||
targets: HashMap<String, String>,
|
||||
footnote_ids: Vec<(Option<&'parse str>, Vec<IAstNode>)>,
|
||||
footnote_reference_counts: HashMap<&'parse str, usize>,
|
||||
on_deck_footnote_ids: HashMap<&'parse str, &'orig Vec<Element<'parse>>>,
|
||||
@@ -31,8 +31,8 @@ impl<'orig, 'parse> Registry<'orig, 'parse> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_target<'reg>(&'reg mut self, body: &'parse str) -> &'reg String {
|
||||
self.targets.entry(body).or_insert_with(|| {
|
||||
pub(crate) fn get_target<S: Into<String>>(&mut self, body: S) -> &String {
|
||||
self.targets.entry(body.into()).or_insert_with(|| {
|
||||
self.id_counter += 1;
|
||||
format!("target_{}", self.id_counter)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user