Create structure for line breaks.

This commit is contained in:
Tom Alexander
2023-07-21 23:48:37 -04:00
parent 6b82214ec3
commit 4d114206ef
5 changed files with 54 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ pub enum Object<'s> {
CitationReference(CitationReference<'s>),
InlineBabelCall(InlineBabelCall<'s>),
InlineSourceBlock(InlineSourceBlock<'s>),
LineBreak(LineBreak<'s>),
}
#[derive(Debug, PartialEq)]
@@ -149,6 +150,11 @@ pub struct InlineSourceBlock<'s> {
pub source: &'s str,
}
#[derive(Debug, PartialEq)]
pub struct LineBreak<'s> {
pub source: &'s str,
}
impl<'s> Source<'s> for Object<'s> {
fn get_source(&'s self) -> &'s str {
match self {
@@ -173,6 +179,7 @@ impl<'s> Source<'s> for Object<'s> {
Object::CitationReference(obj) => obj.source,
Object::InlineBabelCall(obj) => obj.source,
Object::InlineSourceBlock(obj) => obj.source,
Object::LineBreak(obj) => obj.source,
}
}
}
@@ -296,3 +303,9 @@ impl<'s> Source<'s> for InlineSourceBlock<'s> {
self.source
}
}
impl<'s> Source<'s> for LineBreak<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}