Create structure for footnote references.

This commit is contained in:
Tom Alexander
2023-07-19 18:56:46 -04:00
parent c1a99a03f8
commit 9c2eb3b122
6 changed files with 68 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ pub enum Object<'s> {
Entity(Entity<'s>),
LatexFragment(LatexFragment<'s>),
ExportSnippet(ExportSnippet<'s>),
FootnoteReference(FootnoteReference<'s>),
}
#[derive(Debug, PartialEq)]
@@ -117,6 +118,13 @@ pub struct ExportSnippet<'s> {
pub contents: Option<&'s str>,
}
#[derive(Debug, PartialEq)]
pub struct FootnoteReference<'s> {
pub source: &'s str,
pub label: &'s str,
pub definition: Vec<Object<'s>>,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -136,6 +144,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::Entity(obj) => obj.source,
Object::LatexFragment(obj) => obj.source,
Object::ExportSnippet(obj) => obj.source,
Object::FootnoteReference(obj) => obj.source,
}
}
}
@@ -229,3 +238,9 @@ impl<'s> Source<'s> for ExportSnippet<'s> {
self.source
}
}
impl<'s> Source<'s> for FootnoteReference<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}