Create structure for targets.
This commit is contained in:
@@ -43,6 +43,7 @@ mod regular_link;
|
||||
pub mod sexp;
|
||||
mod source;
|
||||
mod table;
|
||||
mod target;
|
||||
mod text_markup;
|
||||
mod token;
|
||||
mod util;
|
||||
@@ -97,6 +98,7 @@ pub use object::RadioLink;
|
||||
pub use object::RadioTarget;
|
||||
pub use object::RegularLink;
|
||||
pub use object::StrikeThrough;
|
||||
pub use object::Target;
|
||||
pub use object::Underline;
|
||||
pub use object::Verbatim;
|
||||
pub use source::Source;
|
||||
|
||||
@@ -24,6 +24,7 @@ pub enum Object<'s> {
|
||||
InlineBabelCall(InlineBabelCall<'s>),
|
||||
InlineSourceBlock(InlineSourceBlock<'s>),
|
||||
LineBreak(LineBreak<'s>),
|
||||
Target(Target<'s>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -155,6 +156,11 @@ pub struct LineBreak<'s> {
|
||||
pub source: &'s str,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Target<'s> {
|
||||
pub source: &'s str,
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Object<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
match self {
|
||||
@@ -180,6 +186,7 @@ impl<'s> Source<'s> for Object<'s> {
|
||||
Object::InlineBabelCall(obj) => obj.source,
|
||||
Object::InlineSourceBlock(obj) => obj.source,
|
||||
Object::LineBreak(obj) => obj.source,
|
||||
Object::Target(obj) => obj.source,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,3 +316,9 @@ impl<'s> Source<'s> for LineBreak<'s> {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for Target<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ impl<'r, 's> Token<'r, 's> {
|
||||
Object::InlineBabelCall(_) => Box::new(std::iter::empty()),
|
||||
Object::InlineSourceBlock(_) => Box::new(std::iter::empty()),
|
||||
Object::LineBreak(_) => Box::new(std::iter::empty()),
|
||||
Object::Target(_) => Box::new(std::iter::empty()),
|
||||
},
|
||||
Token::Element(elem) => match elem {
|
||||
Element::Paragraph(inner) => Box::new(inner.children.iter().map(Token::Object)),
|
||||
|
||||
Reference in New Issue
Block a user