Create structure for LaTeX fragments.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user