2023-04-20 02:09:53 +00:00
|
|
|
use super::object::Object;
|
|
|
|
use super::object::TextMarkup;
|
2023-04-21 20:16:14 +00:00
|
|
|
use super::source::Source;
|
2023-03-25 15:22:59 +00:00
|
|
|
|
2023-03-23 21:26:07 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Paragraph<'s> {
|
|
|
|
pub source: &'s str,
|
2023-03-25 15:22:59 +00:00
|
|
|
pub children: Vec<Object<'s>>,
|
2023-03-23 21:26:07 +00:00
|
|
|
}
|
2023-04-15 20:31:38 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Comment<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
}
|
2023-04-19 01:28:22 +00:00
|
|
|
|
2023-04-20 02:09:53 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct TableCell<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
pub children: Vec<Object<'s>>,
|
|
|
|
}
|
|
|
|
|
2023-04-21 20:31:25 +00:00
|
|
|
#[derive(Debug)]
|
2023-04-21 21:40:49 +00:00
|
|
|
pub struct VerseBlock<'s> {
|
2023-04-21 20:31:25 +00:00
|
|
|
pub source: &'s str,
|
|
|
|
pub name: &'s str,
|
|
|
|
pub data: Option<&'s str>,
|
|
|
|
pub children: Vec<Object<'s>>,
|
|
|
|
}
|
|
|
|
|
2023-04-21 21:32:53 +00:00
|
|
|
#[derive(Debug)]
|
2023-04-21 21:40:49 +00:00
|
|
|
pub struct CommentBlock<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
pub name: &'s str,
|
|
|
|
pub data: Option<&'s str>,
|
|
|
|
pub contents: &'s str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct ExampleBlock<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
pub name: &'s str,
|
|
|
|
pub data: Option<&'s str>,
|
|
|
|
pub contents: &'s str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct ExportBlock<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
pub name: &'s str,
|
|
|
|
pub data: Option<&'s str>,
|
|
|
|
pub contents: &'s str,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct SrcBlock<'s> {
|
2023-04-21 21:32:53 +00:00
|
|
|
pub source: &'s str,
|
|
|
|
pub name: &'s str,
|
|
|
|
pub data: Option<&'s str>,
|
|
|
|
pub contents: &'s str,
|
|
|
|
}
|
|
|
|
|
2023-04-21 23:02:16 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Clock<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
}
|
|
|
|
|
2023-04-22 00:22:31 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct DiarySexp<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
}
|
|
|
|
|
2023-04-22 01:33:23 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Planning<'s> {
|
|
|
|
pub source: &'s str,
|
|
|
|
}
|
|
|
|
|
2023-04-19 01:28:22 +00:00
|
|
|
impl<'s> Paragraph<'s> {
|
|
|
|
pub fn of_text(input: &'s str) -> Self {
|
|
|
|
let mut objects = Vec::with_capacity(1);
|
|
|
|
objects.push(Object::TextMarkup(TextMarkup { source: input }));
|
|
|
|
Paragraph {
|
|
|
|
source: input,
|
|
|
|
children: objects,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 20:16:14 +00:00
|
|
|
|
|
|
|
impl<'s> Source<'s> for Paragraph<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'s> Source<'s> for TableCell<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'s> Source<'s> for Comment<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 21:40:49 +00:00
|
|
|
|
|
|
|
impl<'s> Source<'s> for VerseBlock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'s> Source<'s> for CommentBlock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'s> Source<'s> for ExampleBlock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'s> Source<'s> for ExportBlock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'s> Source<'s> for SrcBlock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 23:02:16 +00:00
|
|
|
|
|
|
|
impl<'s> Source<'s> for Clock<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
2023-04-22 00:22:31 +00:00
|
|
|
|
|
|
|
impl<'s> Source<'s> for DiarySexp<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|
2023-04-22 01:33:23 +00:00
|
|
|
|
|
|
|
impl<'s> Source<'s> for Planning<'s> {
|
|
|
|
fn get_source(&'s self) -> &'s str {
|
|
|
|
self.source
|
|
|
|
}
|
|
|
|
}
|