Create structure for export snippets.
This commit is contained in:
@@ -17,6 +17,7 @@ pub enum Object<'s> {
|
||||
OrgMacro(OrgMacro<'s>),
|
||||
Entity(Entity<'s>),
|
||||
LatexFragment(LatexFragment<'s>),
|
||||
ExportSnippet(ExportSnippet<'s>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -109,6 +110,13 @@ pub struct LatexFragment<'s> {
|
||||
pub source: &'s str,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct ExportSnippet<'s> {
|
||||
pub source: &'s str,
|
||||
pub backend: &'s str,
|
||||
pub contents: &'s str,
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Object<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
match self {
|
||||
@@ -127,6 +135,7 @@ impl<'s> Source<'s> for Object<'s> {
|
||||
Object::OrgMacro(obj) => obj.source,
|
||||
Object::Entity(obj) => obj.source,
|
||||
Object::LatexFragment(obj) => obj.source,
|
||||
Object::ExportSnippet(obj) => obj.source,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,3 +223,9 @@ impl<'s> Source<'s> for LatexFragment<'s> {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for ExportSnippet<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user