Create structure for LaTeX fragments.

This commit is contained in:
Tom Alexander
2023-07-18 20:51:06 -04:00
parent 11e76814f4
commit 3ab0dd4531
6 changed files with 96 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ pub enum Object<'s> {
AngleLink(AngleLink<'s>),
OrgMacro(OrgMacro<'s>),
Entity(Entity<'s>),
LatexFragment(LatexFragment<'s>),
}
#[derive(Debug, PartialEq)]
@@ -103,6 +104,12 @@ pub struct Entity<'s> {
pub entity_name: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct LatexFragment<'s> {
pub source: &'s str,
pub entity_name: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -120,6 +127,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::AngleLink(obj) => obj.source,
Object::OrgMacro(obj) => obj.source,
Object::Entity(obj) => obj.source,
Object::LatexFragment(obj) => obj.source,
}
}
}
@@ -201,3 +209,9 @@ impl<'s> Source<'s> for Entity<'s> {
self.source
}
}
impl<'s> Source<'s> for LatexFragment<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}