Add the skeletons for the elements.

This commit is contained in:
Tom Alexander
2023-10-27 17:08:58 -04:00
parent 860b601f62
commit 23713a934c
46 changed files with 1110 additions and 24 deletions

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IBabelCall {}
impl IBabelCall {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::BabelCall<'parse>,
) -> Result<IBabelCall, CustomError> {
Ok(IBabelCall {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ICenterBlock {}
impl ICenterBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::CenterBlock<'parse>,
) -> Result<ICenterBlock, CustomError> {
Ok(ICenterBlock {})
}
}

15
src/intermediate/clock.rs Normal file
View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IClock {}
impl IClock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::Clock<'parse>,
) -> Result<IClock, CustomError> {
Ok(IClock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ICommentBlock {}
impl ICommentBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::CommentBlock<'parse>,
) -> Result<ICommentBlock, CustomError> {
Ok(ICommentBlock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IDiarySexp {}
impl IDiarySexp {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::DiarySexp<'parse>,
) -> Result<IDiarySexp, CustomError> {
Ok(IDiarySexp {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IDrawer {}
impl IDrawer {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::Drawer<'parse>,
) -> Result<IDrawer, CustomError> {
Ok(IDrawer {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IDynamicBlock {}
impl IDynamicBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::DynamicBlock<'parse>,
) -> Result<IDynamicBlock, CustomError> {
Ok(IDynamicBlock {})
}
}

View File

@@ -3,13 +3,55 @@ use crate::error::CustomError;
use super::comment::IComment;
use super::keyword::IKeyword;
use super::registry::Registry;
use super::IBabelCall;
use super::ICenterBlock;
use super::IClock;
use super::ICommentBlock;
use super::IDiarySexp;
use super::IDrawer;
use super::IDynamicBlock;
use super::IExampleBlock;
use super::IExportBlock;
use super::IFixedWidthArea;
use super::IFootnoteDefinition;
use super::IHorizontalRule;
use super::ILatexEnvironment;
use super::IParagraph;
use super::IPlainList;
use super::IPlanning;
use super::IPropertyDrawer;
use super::IQuoteBlock;
use super::ISpecialBlock;
use super::ISrcBlock;
use super::ITable;
use super::IVerseBlock;
#[derive(Debug)]
pub(crate) enum IElement {
Paragraph(IParagraph),
Keyword(IKeyword),
PlainList(IPlainList),
CenterBlock(ICenterBlock),
QuoteBlock(IQuoteBlock),
SpecialBlock(ISpecialBlock),
DynamicBlock(IDynamicBlock),
FootnoteDefinition(IFootnoteDefinition),
Comment(IComment),
Drawer(IDrawer),
PropertyDrawer(IPropertyDrawer),
Table(ITable),
VerseBlock(IVerseBlock),
CommentBlock(ICommentBlock),
ExampleBlock(IExampleBlock),
ExportBlock(IExportBlock),
SrcBlock(ISrcBlock),
Clock(IClock),
DiarySexp(IDiarySexp),
Planning(IPlanning),
FixedWidthArea(IFixedWidthArea),
HorizontalRule(IHorizontalRule),
Keyword(IKeyword),
BabelCall(IBabelCall),
LatexEnvironment(ILatexEnvironment),
}
impl IElement {
@@ -21,33 +63,75 @@ impl IElement {
organic::types::Element::Paragraph(inner) => {
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
}
organic::types::Element::PlainList(_) => todo!(),
organic::types::Element::CenterBlock(_) => todo!(),
organic::types::Element::QuoteBlock(_) => todo!(),
organic::types::Element::SpecialBlock(_) => todo!(),
organic::types::Element::DynamicBlock(_) => todo!(),
organic::types::Element::FootnoteDefinition(_) => todo!(),
organic::types::Element::PlainList(inner) => {
Ok(IElement::PlainList(IPlainList::new(registry, inner).await?))
}
organic::types::Element::CenterBlock(inner) => Ok(IElement::CenterBlock(
ICenterBlock::new(registry, inner).await?,
)),
organic::types::Element::QuoteBlock(inner) => Ok(IElement::QuoteBlock(
IQuoteBlock::new(registry, inner).await?,
)),
organic::types::Element::SpecialBlock(inner) => Ok(IElement::SpecialBlock(
ISpecialBlock::new(registry, inner).await?,
)),
organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock(
IDynamicBlock::new(registry, inner).await?,
)),
organic::types::Element::FootnoteDefinition(inner) => Ok(IElement::FootnoteDefinition(
IFootnoteDefinition::new(registry, inner).await?,
)),
organic::types::Element::Comment(inner) => {
Ok(IElement::Comment(IComment::new(registry, inner).await?))
}
organic::types::Element::Drawer(_) => todo!(),
organic::types::Element::PropertyDrawer(_) => todo!(),
organic::types::Element::Table(_) => todo!(),
organic::types::Element::VerseBlock(_) => todo!(),
organic::types::Element::CommentBlock(_) => todo!(),
organic::types::Element::ExampleBlock(_) => todo!(),
organic::types::Element::ExportBlock(_) => todo!(),
organic::types::Element::SrcBlock(_) => todo!(),
organic::types::Element::Clock(_) => todo!(),
organic::types::Element::DiarySexp(_) => todo!(),
organic::types::Element::Planning(_) => todo!(),
organic::types::Element::FixedWidthArea(_) => todo!(),
organic::types::Element::HorizontalRule(_) => todo!(),
organic::types::Element::Drawer(inner) => {
Ok(IElement::Drawer(IDrawer::new(registry, inner).await?))
}
organic::types::Element::PropertyDrawer(inner) => Ok(IElement::PropertyDrawer(
IPropertyDrawer::new(registry, inner).await?,
)),
organic::types::Element::Table(inner) => {
Ok(IElement::Table(ITable::new(registry, inner).await?))
}
organic::types::Element::VerseBlock(inner) => Ok(IElement::VerseBlock(
IVerseBlock::new(registry, inner).await?,
)),
organic::types::Element::CommentBlock(inner) => Ok(IElement::CommentBlock(
ICommentBlock::new(registry, inner).await?,
)),
organic::types::Element::ExampleBlock(inner) => Ok(IElement::ExampleBlock(
IExampleBlock::new(registry, inner).await?,
)),
organic::types::Element::ExportBlock(inner) => Ok(IElement::ExportBlock(
IExportBlock::new(registry, inner).await?,
)),
organic::types::Element::SrcBlock(inner) => {
Ok(IElement::SrcBlock(ISrcBlock::new(registry, inner).await?))
}
organic::types::Element::Clock(inner) => {
Ok(IElement::Clock(IClock::new(registry, inner).await?))
}
organic::types::Element::DiarySexp(inner) => {
Ok(IElement::DiarySexp(IDiarySexp::new(registry, inner).await?))
}
organic::types::Element::Planning(inner) => {
Ok(IElement::Planning(IPlanning::new(registry, inner).await?))
}
organic::types::Element::FixedWidthArea(inner) => Ok(IElement::FixedWidthArea(
IFixedWidthArea::new(registry, inner).await?,
)),
organic::types::Element::HorizontalRule(inner) => Ok(IElement::HorizontalRule(
IHorizontalRule::new(registry, inner).await?,
)),
organic::types::Element::Keyword(inner) => {
Ok(IElement::Keyword(IKeyword::new(registry, inner).await?))
}
organic::types::Element::BabelCall(_) => todo!(),
organic::types::Element::LatexEnvironment(_) => todo!(),
organic::types::Element::BabelCall(inner) => {
Ok(IElement::BabelCall(IBabelCall::new(registry, inner).await?))
}
organic::types::Element::LatexEnvironment(inner) => Ok(IElement::LatexEnvironment(
ILatexEnvironment::new(registry, inner).await?,
)),
}
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IExampleBlock {}
impl IExampleBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::ExampleBlock<'parse>,
) -> Result<IExampleBlock, CustomError> {
Ok(IExampleBlock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IExportBlock {}
impl IExportBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::ExportBlock<'parse>,
) -> Result<IExportBlock, CustomError> {
Ok(IExportBlock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IFixedWidthArea {}
impl IFixedWidthArea {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::FixedWidthArea<'parse>,
) -> Result<IFixedWidthArea, CustomError> {
Ok(IFixedWidthArea {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IFootnoteDefinition {}
impl IFootnoteDefinition {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::FootnoteDefinition<'parse>,
) -> Result<IFootnoteDefinition, CustomError> {
Ok(IFootnoteDefinition {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IHorizontalRule {}
impl IHorizontalRule {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::HorizontalRule<'parse>,
) -> Result<IHorizontalRule, CustomError> {
Ok(IHorizontalRule {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ILatexEnvironment {}
impl ILatexEnvironment {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::LatexEnvironment<'parse>,
) -> Result<ILatexEnvironment, CustomError> {
Ok(ILatexEnvironment {})
}
}

View File

@@ -1,28 +1,70 @@
mod babel_call;
mod center_block;
mod clock;
mod comment;
mod comment_block;
mod convert;
mod definition;
mod diary_sexp;
mod document_element;
mod drawer;
mod dynamic_block;
mod element;
mod example_block;
mod export_block;
mod fixed_width_area;
mod footnote_definition;
mod heading;
mod horizontal_rule;
mod keyword;
mod latex_environment;
mod object;
mod page;
mod paragraph;
mod plain_list;
mod plain_text;
mod planning;
mod property_drawer;
mod quote_block;
mod registry;
mod section;
mod special_block;
mod src_block;
mod table;
mod target;
mod util;
mod verse_block;
pub(crate) use babel_call::IBabelCall;
pub(crate) use center_block::ICenterBlock;
pub(crate) use clock::IClock;
pub(crate) use comment::IComment;
pub(crate) use comment_block::ICommentBlock;
pub(crate) use convert::convert_blog_post_page_to_render_context;
pub(crate) use definition::BlogPost;
pub(crate) use diary_sexp::IDiarySexp;
pub(crate) use document_element::IDocumentElement;
pub(crate) use drawer::IDrawer;
pub(crate) use dynamic_block::IDynamicBlock;
pub(crate) use element::IElement;
pub(crate) use example_block::IExampleBlock;
pub(crate) use export_block::IExportBlock;
pub(crate) use fixed_width_area::IFixedWidthArea;
pub(crate) use footnote_definition::IFootnoteDefinition;
pub(crate) use heading::IHeading;
pub(crate) use horizontal_rule::IHorizontalRule;
pub(crate) use keyword::IKeyword;
pub(crate) use latex_environment::ILatexEnvironment;
pub(crate) use object::IObject;
pub(crate) use page::BlogPostPage;
pub(crate) use paragraph::IParagraph;
pub(crate) use plain_list::IPlainList;
pub(crate) use plain_text::IPlainText;
pub(crate) use planning::IPlanning;
pub(crate) use property_drawer::IPropertyDrawer;
pub(crate) use quote_block::IQuoteBlock;
pub(crate) use section::ISection;
pub(crate) use special_block::ISpecialBlock;
pub(crate) use src_block::ISrcBlock;
pub(crate) use table::ITable;
pub(crate) use target::ITarget;
pub(crate) use verse_block::IVerseBlock;

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IPlainList {}
impl IPlainList {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
plain_list: &organic::types::PlainList<'parse>,
) -> Result<IPlainList, CustomError> {
Ok(IPlainList {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IPlanning {}
impl IPlanning {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::Planning<'parse>,
) -> Result<IPlanning, CustomError> {
Ok(IPlanning {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IPropertyDrawer {}
impl IPropertyDrawer {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::PropertyDrawer<'parse>,
) -> Result<IPropertyDrawer, CustomError> {
Ok(IPropertyDrawer {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IQuoteBlock {}
impl IQuoteBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::QuoteBlock<'parse>,
) -> Result<IQuoteBlock, CustomError> {
Ok(IQuoteBlock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ISpecialBlock {}
impl ISpecialBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::SpecialBlock<'parse>,
) -> Result<ISpecialBlock, CustomError> {
Ok(ISpecialBlock {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ISrcBlock {}
impl ISrcBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::SrcBlock<'parse>,
) -> Result<ISrcBlock, CustomError> {
Ok(ISrcBlock {})
}
}

15
src/intermediate/table.rs Normal file
View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct ITable {}
impl ITable {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::Table<'parse>,
) -> Result<ITable, CustomError> {
Ok(ITable {})
}
}

View File

@@ -0,0 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IVerseBlock {}
impl IVerseBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::VerseBlock<'parse>,
) -> Result<IVerseBlock, CustomError> {
Ok(IVerseBlock {})
}
}