Create structure for inline source blocks.

This commit is contained in:
Tom Alexander
2023-07-21 22:29:04 -04:00
parent b323a407c4
commit e0d2bb8213
6 changed files with 69 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ pub enum Object<'s> {
Citation(Citation<'s>),
CitationReference(CitationReference<'s>),
InlineBabelCall(InlineBabelCall<'s>),
InlineSourceBlock(InlineSourceBlock<'s>),
}
#[derive(Debug, PartialEq)]
@@ -143,6 +144,11 @@ pub struct InlineBabelCall<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct InlineSourceBlock<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -166,6 +172,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::Citation(obj) => obj.source,
Object::CitationReference(obj) => obj.source,
Object::InlineBabelCall(obj) => obj.source,
Object::InlineSourceBlock(obj) => obj.source,
}
}
}
@@ -283,3 +290,9 @@ impl<'s> Source<'s> for InlineBabelCall<'s> {
self.source
}
}
impl<'s> Source<'s> for InlineSourceBlock<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}