diff --git a/src/context/angle_link.rs b/src/context/angle_link.rs new file mode 100644 index 0000000..1d97bcf --- /dev/null +++ b/src/context/angle_link.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IAngleLink; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "angle_link")] +pub(crate) struct RenderAngleLink {} + +impl RenderAngleLink { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IAngleLink, + ) -> Result { + Ok(RenderAngleLink {}) + } +} diff --git a/src/context/babel_call.rs b/src/context/babel_call.rs new file mode 100644 index 0000000..cee5641 --- /dev/null +++ b/src/context/babel_call.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IBabelCall; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "babel_call")] +pub(crate) struct RenderBabelCall {} + +impl RenderBabelCall { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IBabelCall, + ) -> Result { + Ok(RenderBabelCall {}) + } +} diff --git a/src/context/bold.rs b/src/context/bold.rs new file mode 100644 index 0000000..1d4edd7 --- /dev/null +++ b/src/context/bold.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IBold; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "bold")] +pub(crate) struct RenderBold {} + +impl RenderBold { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IBold, + ) -> Result { + Ok(RenderBold {}) + } +} diff --git a/src/context/center_block.rs b/src/context/center_block.rs new file mode 100644 index 0000000..c5e024f --- /dev/null +++ b/src/context/center_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ICenterBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "center_block")] +pub(crate) struct RenderCenterBlock {} + +impl RenderCenterBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ICenterBlock, + ) -> Result { + Ok(RenderCenterBlock {}) + } +} diff --git a/src/context/citation.rs b/src/context/citation.rs new file mode 100644 index 0000000..8e6ab3e --- /dev/null +++ b/src/context/citation.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ICitation; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "citation")] +pub(crate) struct RenderCitation {} + +impl RenderCitation { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ICitation, + ) -> Result { + Ok(RenderCitation {}) + } +} diff --git a/src/context/citation_reference.rs b/src/context/citation_reference.rs new file mode 100644 index 0000000..e99800f --- /dev/null +++ b/src/context/citation_reference.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ICitationReference; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "citation_reference")] +pub(crate) struct RenderCitationReference {} + +impl RenderCitationReference { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ICitationReference, + ) -> Result { + Ok(RenderCitationReference {}) + } +} diff --git a/src/context/clock.rs b/src/context/clock.rs new file mode 100644 index 0000000..dc32032 --- /dev/null +++ b/src/context/clock.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IClock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "clock")] +pub(crate) struct RenderClock {} + +impl RenderClock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IClock, + ) -> Result { + Ok(RenderClock {}) + } +} diff --git a/src/context/code.rs b/src/context/code.rs new file mode 100644 index 0000000..cf90a0d --- /dev/null +++ b/src/context/code.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ICode; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "code")] +pub(crate) struct RenderCode {} + +impl RenderCode { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ICode, + ) -> Result { + Ok(RenderCode {}) + } +} diff --git a/src/context/comment_block.rs b/src/context/comment_block.rs new file mode 100644 index 0000000..d4cf314 --- /dev/null +++ b/src/context/comment_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ICommentBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "comment_block")] +pub(crate) struct RenderCommentBlock {} + +impl RenderCommentBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ICommentBlock, + ) -> Result { + Ok(RenderCommentBlock {}) + } +} diff --git a/src/context/diary_sexp.rs b/src/context/diary_sexp.rs new file mode 100644 index 0000000..8a3e5f4 --- /dev/null +++ b/src/context/diary_sexp.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IDiarySexp; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "diary_sexp")] +pub(crate) struct RenderDiarySexp {} + +impl RenderDiarySexp { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IDiarySexp, + ) -> Result { + Ok(RenderDiarySexp {}) + } +} diff --git a/src/context/drawer.rs b/src/context/drawer.rs new file mode 100644 index 0000000..1872b26 --- /dev/null +++ b/src/context/drawer.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IDrawer; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "drawer")] +pub(crate) struct RenderDrawer {} + +impl RenderDrawer { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IDrawer, + ) -> Result { + Ok(RenderDrawer {}) + } +} diff --git a/src/context/dynamic_block.rs b/src/context/dynamic_block.rs new file mode 100644 index 0000000..4535bf2 --- /dev/null +++ b/src/context/dynamic_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IDynamicBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "dynamic_block")] +pub(crate) struct RenderDynamicBlock {} + +impl RenderDynamicBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IDynamicBlock, + ) -> Result { + Ok(RenderDynamicBlock {}) + } +} diff --git a/src/context/element.rs b/src/context/element.rs index 5144938..7d27ab6 100644 --- a/src/context/element.rs +++ b/src/context/element.rs @@ -6,16 +6,58 @@ use crate::config::Config; use crate::error::CustomError; use crate::intermediate::IElement; +use super::babel_call::RenderBabelCall; +use super::center_block::RenderCenterBlock; +use super::clock::RenderClock; use super::comment::RenderComment; +use super::comment_block::RenderCommentBlock; +use super::diary_sexp::RenderDiarySexp; +use super::drawer::RenderDrawer; +use super::dynamic_block::RenderDynamicBlock; +use super::example_block::RenderExampleBlock; +use super::export_block::RenderExportBlock; +use super::fixed_width_area::RenderFixedWidthArea; +use super::footnote_definition::RenderFootnoteDefinition; +use super::horizontal_rule::RenderHorizontalRule; use super::keyword::RenderKeyword; +use super::latex_environment::RenderLatexEnvironment; use super::paragraph::RenderParagraph; +use super::plain_list::RenderPlainList; +use super::planning::RenderPlanning; +use super::property_drawer::RenderPropertyDrawer; +use super::quote_block::RenderQuoteBlock; +use super::special_block::RenderSpecialBlock; +use super::src_block::RenderSrcBlock; +use super::table::RenderTable; +use super::verse_block::RenderVerseBlock; #[derive(Debug, Serialize)] #[serde(untagged)] pub(crate) enum RenderElement { Paragraph(RenderParagraph), - Keyword(RenderKeyword), + PlainList(RenderPlainList), + CenterBlock(RenderCenterBlock), + QuoteBlock(RenderQuoteBlock), + SpecialBlock(RenderSpecialBlock), + DynamicBlock(RenderDynamicBlock), + FootnoteDefinition(RenderFootnoteDefinition), Comment(RenderComment), + Drawer(RenderDrawer), + PropertyDrawer(RenderPropertyDrawer), + Table(RenderTable), + VerseBlock(RenderVerseBlock), + CommentBlock(RenderCommentBlock), + ExampleBlock(RenderExampleBlock), + ExportBlock(RenderExportBlock), + SrcBlock(RenderSrcBlock), + Clock(RenderClock), + DiarySexp(RenderDiarySexp), + Planning(RenderPlanning), + FixedWidthArea(RenderFixedWidthArea), + HorizontalRule(RenderHorizontalRule), + Keyword(RenderKeyword), + BabelCall(RenderBabelCall), + LatexEnvironment(RenderLatexEnvironment), } impl RenderElement { @@ -32,18 +74,117 @@ impl RenderElement { output_file, inner, )?)), - IElement::Keyword(inner) => Ok(RenderElement::Keyword(RenderKeyword::new( + IElement::PlainList(inner) => Ok(RenderElement::PlainList(RenderPlainList::new( config, output_directory, output_file, inner, )?)), + IElement::CenterBlock(inner) => Ok(RenderElement::CenterBlock(RenderCenterBlock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::QuoteBlock(inner) => Ok(RenderElement::QuoteBlock(RenderQuoteBlock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::SpecialBlock(inner) => Ok(RenderElement::SpecialBlock( + RenderSpecialBlock::new(config, output_directory, output_file, inner)?, + )), + IElement::DynamicBlock(inner) => Ok(RenderElement::DynamicBlock( + RenderDynamicBlock::new(config, output_directory, output_file, inner)?, + )), + IElement::FootnoteDefinition(inner) => Ok(RenderElement::FootnoteDefinition( + RenderFootnoteDefinition::new(config, output_directory, output_file, inner)?, + )), IElement::Comment(inner) => Ok(RenderElement::Comment(RenderComment::new( config, output_directory, output_file, inner, )?)), + IElement::Drawer(inner) => Ok(RenderElement::Drawer(RenderDrawer::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::PropertyDrawer(inner) => Ok(RenderElement::PropertyDrawer( + RenderPropertyDrawer::new(config, output_directory, output_file, inner)?, + )), + IElement::Table(inner) => Ok(RenderElement::Table(RenderTable::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::VerseBlock(inner) => Ok(RenderElement::VerseBlock(RenderVerseBlock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::CommentBlock(inner) => Ok(RenderElement::CommentBlock( + RenderCommentBlock::new(config, output_directory, output_file, inner)?, + )), + IElement::ExampleBlock(inner) => Ok(RenderElement::ExampleBlock( + RenderExampleBlock::new(config, output_directory, output_file, inner)?, + )), + IElement::ExportBlock(inner) => Ok(RenderElement::ExportBlock(RenderExportBlock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::SrcBlock(inner) => Ok(RenderElement::SrcBlock(RenderSrcBlock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::Clock(inner) => Ok(RenderElement::Clock(RenderClock::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::DiarySexp(inner) => Ok(RenderElement::DiarySexp(RenderDiarySexp::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::Planning(inner) => Ok(RenderElement::Planning(RenderPlanning::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::FixedWidthArea(inner) => Ok(RenderElement::FixedWidthArea( + RenderFixedWidthArea::new(config, output_directory, output_file, inner)?, + )), + IElement::HorizontalRule(inner) => Ok(RenderElement::HorizontalRule( + RenderHorizontalRule::new(config, output_directory, output_file, inner)?, + )), + IElement::Keyword(inner) => Ok(RenderElement::Keyword(RenderKeyword::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::BabelCall(inner) => Ok(RenderElement::BabelCall(RenderBabelCall::new( + config, + output_directory, + output_file, + inner, + )?)), + IElement::LatexEnvironment(inner) => Ok(RenderElement::LatexEnvironment( + RenderLatexEnvironment::new(config, output_directory, output_file, inner)?, + )), } } } diff --git a/src/context/entity.rs b/src/context/entity.rs new file mode 100644 index 0000000..a395ed9 --- /dev/null +++ b/src/context/entity.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IEntity; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "entity")] +pub(crate) struct RenderEntity {} + +impl RenderEntity { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IEntity, + ) -> Result { + Ok(RenderEntity {}) + } +} diff --git a/src/context/example_block.rs b/src/context/example_block.rs new file mode 100644 index 0000000..dec90ab --- /dev/null +++ b/src/context/example_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IExampleBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "example_block")] +pub(crate) struct RenderExampleBlock {} + +impl RenderExampleBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IExampleBlock, + ) -> Result { + Ok(RenderExampleBlock {}) + } +} diff --git a/src/context/export_block.rs b/src/context/export_block.rs new file mode 100644 index 0000000..bd035eb --- /dev/null +++ b/src/context/export_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IExportBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "export_block")] +pub(crate) struct RenderExportBlock {} + +impl RenderExportBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IExportBlock, + ) -> Result { + Ok(RenderExportBlock {}) + } +} diff --git a/src/context/export_snippet.rs b/src/context/export_snippet.rs new file mode 100644 index 0000000..a6fe6cc --- /dev/null +++ b/src/context/export_snippet.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IExportSnippet; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "export_snippet")] +pub(crate) struct RenderExportSnippet {} + +impl RenderExportSnippet { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IExportSnippet, + ) -> Result { + Ok(RenderExportSnippet {}) + } +} diff --git a/src/context/fixed_width_area.rs b/src/context/fixed_width_area.rs new file mode 100644 index 0000000..e079ded --- /dev/null +++ b/src/context/fixed_width_area.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IFixedWidthArea; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "fixed_width_area")] +pub(crate) struct RenderFixedWidthArea {} + +impl RenderFixedWidthArea { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IFixedWidthArea, + ) -> Result { + Ok(RenderFixedWidthArea {}) + } +} diff --git a/src/context/footnote_definition.rs b/src/context/footnote_definition.rs new file mode 100644 index 0000000..e062c28 --- /dev/null +++ b/src/context/footnote_definition.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IFootnoteDefinition; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "footnote_definition")] +pub(crate) struct RenderFootnoteDefinition {} + +impl RenderFootnoteDefinition { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IFootnoteDefinition, + ) -> Result { + Ok(RenderFootnoteDefinition {}) + } +} diff --git a/src/context/footnote_reference.rs b/src/context/footnote_reference.rs new file mode 100644 index 0000000..6fbe88c --- /dev/null +++ b/src/context/footnote_reference.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IFootnoteReference; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "footnote_reference")] +pub(crate) struct RenderFootnoteReference {} + +impl RenderFootnoteReference { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IFootnoteReference, + ) -> Result { + Ok(RenderFootnoteReference {}) + } +} diff --git a/src/context/horizontal_rule.rs b/src/context/horizontal_rule.rs new file mode 100644 index 0000000..781635e --- /dev/null +++ b/src/context/horizontal_rule.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IHorizontalRule; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "horizontal_rule")] +pub(crate) struct RenderHorizontalRule {} + +impl RenderHorizontalRule { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IHorizontalRule, + ) -> Result { + Ok(RenderHorizontalRule {}) + } +} diff --git a/src/context/inline_babel_call.rs b/src/context/inline_babel_call.rs new file mode 100644 index 0000000..cab345c --- /dev/null +++ b/src/context/inline_babel_call.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IInlineBabelCall; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "inline_babel_call")] +pub(crate) struct RenderInlineBabelCall {} + +impl RenderInlineBabelCall { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IInlineBabelCall, + ) -> Result { + Ok(RenderInlineBabelCall {}) + } +} diff --git a/src/context/inline_source_block.rs b/src/context/inline_source_block.rs new file mode 100644 index 0000000..7303a8f --- /dev/null +++ b/src/context/inline_source_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IInlineSourceBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "inline_source_block")] +pub(crate) struct RenderInlineSourceBlock {} + +impl RenderInlineSourceBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IInlineSourceBlock, + ) -> Result { + Ok(RenderInlineSourceBlock {}) + } +} diff --git a/src/context/italic.rs b/src/context/italic.rs new file mode 100644 index 0000000..7f3bf4c --- /dev/null +++ b/src/context/italic.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IItalic; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "italic")] +pub(crate) struct RenderItalic {} + +impl RenderItalic { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IItalic, + ) -> Result { + Ok(RenderItalic {}) + } +} diff --git a/src/context/latex_environment.rs b/src/context/latex_environment.rs new file mode 100644 index 0000000..b7b75ae --- /dev/null +++ b/src/context/latex_environment.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ILatexEnvironment; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "latex_environment")] +pub(crate) struct RenderLatexEnvironment {} + +impl RenderLatexEnvironment { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ILatexEnvironment, + ) -> Result { + Ok(RenderLatexEnvironment {}) + } +} diff --git a/src/context/latex_fragment.rs b/src/context/latex_fragment.rs new file mode 100644 index 0000000..69fdb94 --- /dev/null +++ b/src/context/latex_fragment.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ILatexFragment; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "latex_fragment")] +pub(crate) struct RenderLatexFragment {} + +impl RenderLatexFragment { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ILatexFragment, + ) -> Result { + Ok(RenderLatexFragment {}) + } +} diff --git a/src/context/line_break.rs b/src/context/line_break.rs new file mode 100644 index 0000000..68394da --- /dev/null +++ b/src/context/line_break.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ILineBreak; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "line_break")] +pub(crate) struct RenderLineBreak {} + +impl RenderLineBreak { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ILineBreak, + ) -> Result { + Ok(RenderLineBreak {}) + } +} diff --git a/src/context/mod.rs b/src/context/mod.rs index 96a8811..7c50714 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -1,15 +1,61 @@ +mod angle_link; +mod babel_call; mod blog_post_page; +mod bold; +mod center_block; +mod citation; +mod citation_reference; +mod clock; +mod code; mod comment; +mod comment_block; +mod diary_sexp; mod document_element; +mod drawer; +mod dynamic_block; mod element; +mod entity; +mod example_block; +mod export_block; +mod export_snippet; +mod fixed_width_area; +mod footnote_definition; +mod footnote_reference; mod global_settings; mod heading; +mod horizontal_rule; +mod inline_babel_call; +mod inline_source_block; +mod italic; mod keyword; +mod latex_environment; +mod latex_fragment; +mod line_break; mod object; +mod org_macro; mod paragraph; +mod plain_link; +mod plain_list; mod plain_text; +mod planning; +mod property_drawer; +mod quote_block; +mod radio_link; +mod radio_target; +mod regular_link; mod section; +mod special_block; +mod src_block; +mod statistics_cookie; +mod strike_through; +mod subscript; +mod superscript; +mod table; mod target; +mod timestamp; +mod underline; +mod verbatim; +mod verse_block; pub(crate) use blog_post_page::RenderBlogPostPage; pub(crate) use document_element::RenderDocumentElement; diff --git a/src/context/object.rs b/src/context/object.rs index c54a619..63e65d1 100644 --- a/src/context/object.rs +++ b/src/context/object.rs @@ -6,14 +6,64 @@ use crate::config::Config; use crate::error::CustomError; use crate::intermediate::IObject; +use super::angle_link::RenderAngleLink; +use super::bold::RenderBold; +use super::citation::RenderCitation; +use super::citation_reference::RenderCitationReference; +use super::code::RenderCode; +use super::entity::RenderEntity; +use super::export_snippet::RenderExportSnippet; +use super::footnote_reference::RenderFootnoteReference; +use super::inline_babel_call::RenderInlineBabelCall; +use super::inline_source_block::RenderInlineSourceBlock; +use super::italic::RenderItalic; +use super::latex_fragment::RenderLatexFragment; +use super::line_break::RenderLineBreak; +use super::org_macro::RenderOrgMacro; +use super::plain_link::RenderPlainLink; use super::plain_text::RenderPlainText; +use super::radio_link::RenderRadioLink; +use super::radio_target::RenderRadioTarget; +use super::regular_link::RenderRegularLink; +use super::statistics_cookie::RenderStatisticsCookie; +use super::strike_through::RenderStrikeThrough; +use super::subscript::RenderSubscript; +use super::superscript::RenderSuperscript; use super::target::RenderTarget; +use super::timestamp::RenderTimestamp; +use super::underline::RenderUnderline; +use super::verbatim::RenderVerbatim; #[derive(Debug, Serialize)] #[serde(untagged)] pub(crate) enum RenderObject { + Bold(RenderBold), + Italic(RenderItalic), + Underline(RenderUnderline), + StrikeThrough(RenderStrikeThrough), + Code(RenderCode), + Verbatim(RenderVerbatim), PlainText(RenderPlainText), + RegularLink(RenderRegularLink), + RadioLink(RenderRadioLink), + RadioTarget(RenderRadioTarget), + PlainLink(RenderPlainLink), + AngleLink(RenderAngleLink), + OrgMacro(RenderOrgMacro), + Entity(RenderEntity), + LatexFragment(RenderLatexFragment), + ExportSnippet(RenderExportSnippet), + FootnoteReference(RenderFootnoteReference), + Citation(RenderCitation), + CitationReference(RenderCitationReference), + InlineBabelCall(RenderInlineBabelCall), + InlineSourceBlock(RenderInlineSourceBlock), + LineBreak(RenderLineBreak), Target(RenderTarget), + StatisticsCookie(RenderStatisticsCookie), + Subscript(RenderSubscript), + Superscript(RenderSuperscript), + Timestamp(RenderTimestamp), } impl RenderObject { @@ -24,18 +74,144 @@ impl RenderObject { object: &IObject, ) -> Result { match object { + IObject::Bold(inner) => Ok(RenderObject::Bold(RenderBold::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Italic(inner) => Ok(RenderObject::Italic(RenderItalic::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Underline(inner) => Ok(RenderObject::Underline(RenderUnderline::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::StrikeThrough(inner) => Ok(RenderObject::StrikeThrough( + RenderStrikeThrough::new(config, output_directory, output_file, inner)?, + )), + IObject::Code(inner) => Ok(RenderObject::Code(RenderCode::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Verbatim(inner) => Ok(RenderObject::Verbatim(RenderVerbatim::new( + config, + output_directory, + output_file, + inner, + )?)), IObject::PlainText(inner) => Ok(RenderObject::PlainText(RenderPlainText::new( config, output_directory, output_file, inner, )?)), + IObject::RegularLink(inner) => Ok(RenderObject::RegularLink(RenderRegularLink::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::RadioLink(inner) => Ok(RenderObject::RadioLink(RenderRadioLink::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::RadioTarget(inner) => Ok(RenderObject::RadioTarget(RenderRadioTarget::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::PlainLink(inner) => Ok(RenderObject::PlainLink(RenderPlainLink::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::AngleLink(inner) => Ok(RenderObject::AngleLink(RenderAngleLink::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::OrgMacro(inner) => Ok(RenderObject::OrgMacro(RenderOrgMacro::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Entity(inner) => Ok(RenderObject::Entity(RenderEntity::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::LatexFragment(inner) => Ok(RenderObject::LatexFragment( + RenderLatexFragment::new(config, output_directory, output_file, inner)?, + )), + IObject::ExportSnippet(inner) => Ok(RenderObject::ExportSnippet( + RenderExportSnippet::new(config, output_directory, output_file, inner)?, + )), + IObject::FootnoteReference(inner) => Ok(RenderObject::FootnoteReference( + RenderFootnoteReference::new(config, output_directory, output_file, inner)?, + )), + IObject::Citation(inner) => Ok(RenderObject::Citation(RenderCitation::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::CitationReference(inner) => Ok(RenderObject::CitationReference( + RenderCitationReference::new(config, output_directory, output_file, inner)?, + )), + IObject::InlineBabelCall(inner) => Ok(RenderObject::InlineBabelCall( + RenderInlineBabelCall::new(config, output_directory, output_file, inner)?, + )), + IObject::InlineSourceBlock(inner) => Ok(RenderObject::InlineSourceBlock( + RenderInlineSourceBlock::new(config, output_directory, output_file, inner)?, + )), + IObject::LineBreak(inner) => Ok(RenderObject::LineBreak(RenderLineBreak::new( + config, + output_directory, + output_file, + inner, + )?)), IObject::Target(inner) => Ok(RenderObject::Target(RenderTarget::new( config, output_directory, output_file, inner, )?)), + IObject::StatisticsCookie(inner) => Ok(RenderObject::StatisticsCookie( + RenderStatisticsCookie::new(config, output_directory, output_file, inner)?, + )), + IObject::Subscript(inner) => Ok(RenderObject::Subscript(RenderSubscript::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Superscript(inner) => Ok(RenderObject::Superscript(RenderSuperscript::new( + config, + output_directory, + output_file, + inner, + )?)), + IObject::Timestamp(inner) => Ok(RenderObject::Timestamp(RenderTimestamp::new( + config, + output_directory, + output_file, + inner, + )?)), } } } diff --git a/src/context/org_macro.rs b/src/context/org_macro.rs new file mode 100644 index 0000000..87c144b --- /dev/null +++ b/src/context/org_macro.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IOrgMacro; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "org_macro")] +pub(crate) struct RenderOrgMacro {} + +impl RenderOrgMacro { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IOrgMacro, + ) -> Result { + Ok(RenderOrgMacro {}) + } +} diff --git a/src/context/plain_link.rs b/src/context/plain_link.rs new file mode 100644 index 0000000..9951f5a --- /dev/null +++ b/src/context/plain_link.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IPlainLink; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "plain_link")] +pub(crate) struct RenderPlainLink {} + +impl RenderPlainLink { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IPlainLink, + ) -> Result { + Ok(RenderPlainLink {}) + } +} diff --git a/src/context/plain_list.rs b/src/context/plain_list.rs new file mode 100644 index 0000000..746d222 --- /dev/null +++ b/src/context/plain_list.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IPlainList; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "plain_list")] +pub(crate) struct RenderPlainList {} + +impl RenderPlainList { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IPlainList, + ) -> Result { + Ok(RenderPlainList {}) + } +} diff --git a/src/context/planning.rs b/src/context/planning.rs new file mode 100644 index 0000000..1086dc2 --- /dev/null +++ b/src/context/planning.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IPlanning; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "planning")] +pub(crate) struct RenderPlanning {} + +impl RenderPlanning { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IPlanning, + ) -> Result { + Ok(RenderPlanning {}) + } +} diff --git a/src/context/property_drawer.rs b/src/context/property_drawer.rs new file mode 100644 index 0000000..d85c72b --- /dev/null +++ b/src/context/property_drawer.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IPropertyDrawer; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "property_drawer")] +pub(crate) struct RenderPropertyDrawer {} + +impl RenderPropertyDrawer { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IPropertyDrawer, + ) -> Result { + Ok(RenderPropertyDrawer {}) + } +} diff --git a/src/context/quote_block.rs b/src/context/quote_block.rs new file mode 100644 index 0000000..6de04e0 --- /dev/null +++ b/src/context/quote_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IQuoteBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "quote_block")] +pub(crate) struct RenderQuoteBlock {} + +impl RenderQuoteBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IQuoteBlock, + ) -> Result { + Ok(RenderQuoteBlock {}) + } +} diff --git a/src/context/radio_link.rs b/src/context/radio_link.rs new file mode 100644 index 0000000..6001f51 --- /dev/null +++ b/src/context/radio_link.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IRadioLink; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "radio_link")] +pub(crate) struct RenderRadioLink {} + +impl RenderRadioLink { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IRadioLink, + ) -> Result { + Ok(RenderRadioLink {}) + } +} diff --git a/src/context/radio_target.rs b/src/context/radio_target.rs new file mode 100644 index 0000000..b56a020 --- /dev/null +++ b/src/context/radio_target.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IRadioTarget; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "radio_target")] +pub(crate) struct RenderRadioTarget {} + +impl RenderRadioTarget { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IRadioTarget, + ) -> Result { + Ok(RenderRadioTarget {}) + } +} diff --git a/src/context/regular_link.rs b/src/context/regular_link.rs new file mode 100644 index 0000000..6727714 --- /dev/null +++ b/src/context/regular_link.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IRegularLink; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "regular_link")] +pub(crate) struct RenderRegularLink {} + +impl RenderRegularLink { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IRegularLink, + ) -> Result { + Ok(RenderRegularLink {}) + } +} diff --git a/src/context/special_block.rs b/src/context/special_block.rs new file mode 100644 index 0000000..b8906ff --- /dev/null +++ b/src/context/special_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ISpecialBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "special_block")] +pub(crate) struct RenderSpecialBlock {} + +impl RenderSpecialBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ISpecialBlock, + ) -> Result { + Ok(RenderSpecialBlock {}) + } +} diff --git a/src/context/src_block.rs b/src/context/src_block.rs new file mode 100644 index 0000000..cdbf0ec --- /dev/null +++ b/src/context/src_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ISrcBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "src_block")] +pub(crate) struct RenderSrcBlock {} + +impl RenderSrcBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ISrcBlock, + ) -> Result { + Ok(RenderSrcBlock {}) + } +} diff --git a/src/context/statistics_cookie.rs b/src/context/statistics_cookie.rs new file mode 100644 index 0000000..774f1f3 --- /dev/null +++ b/src/context/statistics_cookie.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IStatisticsCookie; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "statistics_cookie")] +pub(crate) struct RenderStatisticsCookie {} + +impl RenderStatisticsCookie { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IStatisticsCookie, + ) -> Result { + Ok(RenderStatisticsCookie {}) + } +} diff --git a/src/context/strike_through.rs b/src/context/strike_through.rs new file mode 100644 index 0000000..2f0249f --- /dev/null +++ b/src/context/strike_through.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IStrikeThrough; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "strike_through")] +pub(crate) struct RenderStrikeThrough {} + +impl RenderStrikeThrough { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IStrikeThrough, + ) -> Result { + Ok(RenderStrikeThrough {}) + } +} diff --git a/src/context/subscript.rs b/src/context/subscript.rs new file mode 100644 index 0000000..dd31b29 --- /dev/null +++ b/src/context/subscript.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ISubscript; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "subscript")] +pub(crate) struct RenderSubscript {} + +impl RenderSubscript { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ISubscript, + ) -> Result { + Ok(RenderSubscript {}) + } +} diff --git a/src/context/superscript.rs b/src/context/superscript.rs new file mode 100644 index 0000000..f47fac7 --- /dev/null +++ b/src/context/superscript.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ISuperscript; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "superscript")] +pub(crate) struct RenderSuperscript {} + +impl RenderSuperscript { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ISuperscript, + ) -> Result { + Ok(RenderSuperscript {}) + } +} diff --git a/src/context/table.rs b/src/context/table.rs new file mode 100644 index 0000000..b80c216 --- /dev/null +++ b/src/context/table.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ITable; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "table")] +pub(crate) struct RenderTable {} + +impl RenderTable { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &ITable, + ) -> Result { + Ok(RenderTable {}) + } +} diff --git a/src/context/timestamp.rs b/src/context/timestamp.rs new file mode 100644 index 0000000..fa1daa3 --- /dev/null +++ b/src/context/timestamp.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::ITimestamp; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "timestamp")] +pub(crate) struct RenderTimestamp {} + +impl RenderTimestamp { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &ITimestamp, + ) -> Result { + Ok(RenderTimestamp {}) + } +} diff --git a/src/context/underline.rs b/src/context/underline.rs new file mode 100644 index 0000000..4575881 --- /dev/null +++ b/src/context/underline.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IUnderline; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "underline")] +pub(crate) struct RenderUnderline {} + +impl RenderUnderline { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IUnderline, + ) -> Result { + Ok(RenderUnderline {}) + } +} diff --git a/src/context/verbatim.rs b/src/context/verbatim.rs new file mode 100644 index 0000000..2523c83 --- /dev/null +++ b/src/context/verbatim.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IVerbatim; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "verbatim")] +pub(crate) struct RenderVerbatim {} + +impl RenderVerbatim { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + comment: &IVerbatim, + ) -> Result { + Ok(RenderVerbatim {}) + } +} diff --git a/src/context/verse_block.rs b/src/context/verse_block.rs new file mode 100644 index 0000000..bc14724 --- /dev/null +++ b/src/context/verse_block.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use serde::Serialize; + +use crate::config::Config; +use crate::error::CustomError; +use crate::intermediate::IVerseBlock; + +#[derive(Debug, Serialize)] +#[serde(tag = "type")] +#[serde(rename = "verse_block")] +pub(crate) struct RenderVerseBlock {} + +impl RenderVerseBlock { + pub(crate) fn new, F: AsRef>( + config: &Config, + output_directory: D, + output_file: F, + original: &IVerseBlock, + ) -> Result { + Ok(RenderVerseBlock {}) + } +} diff --git a/src/intermediate/angle_link.rs b/src/intermediate/angle_link.rs new file mode 100644 index 0000000..bd84243 --- /dev/null +++ b/src/intermediate/angle_link.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IAngleLink {} + +impl IAngleLink { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::AngleLink<'parse>, + ) -> Result { + Ok(IAngleLink {}) + } +} diff --git a/src/intermediate/babel_call.rs b/src/intermediate/babel_call.rs new file mode 100644 index 0000000..a8d542c --- /dev/null +++ b/src/intermediate/babel_call.rs @@ -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 { + Ok(IBabelCall {}) + } +} diff --git a/src/intermediate/bold.rs b/src/intermediate/bold.rs new file mode 100644 index 0000000..c00f94b --- /dev/null +++ b/src/intermediate/bold.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IBold {} + +impl IBold { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Bold<'parse>, + ) -> Result { + Ok(IBold {}) + } +} diff --git a/src/intermediate/center_block.rs b/src/intermediate/center_block.rs new file mode 100644 index 0000000..2e4d777 --- /dev/null +++ b/src/intermediate/center_block.rs @@ -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 { + Ok(ICenterBlock {}) + } +} diff --git a/src/intermediate/citation.rs b/src/intermediate/citation.rs new file mode 100644 index 0000000..1209241 --- /dev/null +++ b/src/intermediate/citation.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ICitation {} + +impl ICitation { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Citation<'parse>, + ) -> Result { + Ok(ICitation {}) + } +} diff --git a/src/intermediate/citation_reference.rs b/src/intermediate/citation_reference.rs new file mode 100644 index 0000000..1030158 --- /dev/null +++ b/src/intermediate/citation_reference.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ICitationReference {} + +impl ICitationReference { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::CitationReference<'parse>, + ) -> Result { + Ok(ICitationReference {}) + } +} diff --git a/src/intermediate/clock.rs b/src/intermediate/clock.rs new file mode 100644 index 0000000..5f3b8eb --- /dev/null +++ b/src/intermediate/clock.rs @@ -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 { + Ok(IClock {}) + } +} diff --git a/src/intermediate/code.rs b/src/intermediate/code.rs new file mode 100644 index 0000000..6a137ba --- /dev/null +++ b/src/intermediate/code.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ICode {} + +impl ICode { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Code<'parse>, + ) -> Result { + Ok(ICode {}) + } +} diff --git a/src/intermediate/comment_block.rs b/src/intermediate/comment_block.rs new file mode 100644 index 0000000..71602eb --- /dev/null +++ b/src/intermediate/comment_block.rs @@ -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 { + Ok(ICommentBlock {}) + } +} diff --git a/src/intermediate/diary_sexp.rs b/src/intermediate/diary_sexp.rs new file mode 100644 index 0000000..5f4d4a4 --- /dev/null +++ b/src/intermediate/diary_sexp.rs @@ -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 { + Ok(IDiarySexp {}) + } +} diff --git a/src/intermediate/drawer.rs b/src/intermediate/drawer.rs new file mode 100644 index 0000000..b55fd71 --- /dev/null +++ b/src/intermediate/drawer.rs @@ -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 { + Ok(IDrawer {}) + } +} diff --git a/src/intermediate/dynamic_block.rs b/src/intermediate/dynamic_block.rs new file mode 100644 index 0000000..6086e9d --- /dev/null +++ b/src/intermediate/dynamic_block.rs @@ -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 { + Ok(IDynamicBlock {}) + } +} diff --git a/src/intermediate/element.rs b/src/intermediate/element.rs index fd2b4f1..255afd2 100644 --- a/src/intermediate/element.rs +++ b/src/intermediate/element.rs @@ -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?, + )), } } } diff --git a/src/intermediate/entity.rs b/src/intermediate/entity.rs new file mode 100644 index 0000000..a3160cb --- /dev/null +++ b/src/intermediate/entity.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IEntity {} + +impl IEntity { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Entity<'parse>, + ) -> Result { + Ok(IEntity {}) + } +} diff --git a/src/intermediate/example_block.rs b/src/intermediate/example_block.rs new file mode 100644 index 0000000..2c65752 --- /dev/null +++ b/src/intermediate/example_block.rs @@ -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 { + Ok(IExampleBlock {}) + } +} diff --git a/src/intermediate/export_block.rs b/src/intermediate/export_block.rs new file mode 100644 index 0000000..ff24258 --- /dev/null +++ b/src/intermediate/export_block.rs @@ -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 { + Ok(IExportBlock {}) + } +} diff --git a/src/intermediate/export_snippet.rs b/src/intermediate/export_snippet.rs new file mode 100644 index 0000000..6a2c331 --- /dev/null +++ b/src/intermediate/export_snippet.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IExportSnippet {} + +impl IExportSnippet { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::ExportSnippet<'parse>, + ) -> Result { + Ok(IExportSnippet {}) + } +} diff --git a/src/intermediate/fixed_width_area.rs b/src/intermediate/fixed_width_area.rs new file mode 100644 index 0000000..6cdf376 --- /dev/null +++ b/src/intermediate/fixed_width_area.rs @@ -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 { + Ok(IFixedWidthArea {}) + } +} diff --git a/src/intermediate/footnote_definition.rs b/src/intermediate/footnote_definition.rs new file mode 100644 index 0000000..35964bb --- /dev/null +++ b/src/intermediate/footnote_definition.rs @@ -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 { + Ok(IFootnoteDefinition {}) + } +} diff --git a/src/intermediate/footnote_reference.rs b/src/intermediate/footnote_reference.rs new file mode 100644 index 0000000..cb393c2 --- /dev/null +++ b/src/intermediate/footnote_reference.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IFootnoteReference {} + +impl IFootnoteReference { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::FootnoteReference<'parse>, + ) -> Result { + Ok(IFootnoteReference {}) + } +} diff --git a/src/intermediate/horizontal_rule.rs b/src/intermediate/horizontal_rule.rs new file mode 100644 index 0000000..0be08c6 --- /dev/null +++ b/src/intermediate/horizontal_rule.rs @@ -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 { + Ok(IHorizontalRule {}) + } +} diff --git a/src/intermediate/inline_babel_call.rs b/src/intermediate/inline_babel_call.rs new file mode 100644 index 0000000..874f5c4 --- /dev/null +++ b/src/intermediate/inline_babel_call.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IInlineBabelCall {} + +impl IInlineBabelCall { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::InlineBabelCall<'parse>, + ) -> Result { + Ok(IInlineBabelCall {}) + } +} diff --git a/src/intermediate/inline_source_block.rs b/src/intermediate/inline_source_block.rs new file mode 100644 index 0000000..5a90e29 --- /dev/null +++ b/src/intermediate/inline_source_block.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IInlineSourceBlock {} + +impl IInlineSourceBlock { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::InlineSourceBlock<'parse>, + ) -> Result { + Ok(IInlineSourceBlock {}) + } +} diff --git a/src/intermediate/italic.rs b/src/intermediate/italic.rs new file mode 100644 index 0000000..79ce541 --- /dev/null +++ b/src/intermediate/italic.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IItalic {} + +impl IItalic { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Italic<'parse>, + ) -> Result { + Ok(IItalic {}) + } +} diff --git a/src/intermediate/latex_environment.rs b/src/intermediate/latex_environment.rs new file mode 100644 index 0000000..c6ccaac --- /dev/null +++ b/src/intermediate/latex_environment.rs @@ -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 { + Ok(ILatexEnvironment {}) + } +} diff --git a/src/intermediate/latex_fragment.rs b/src/intermediate/latex_fragment.rs new file mode 100644 index 0000000..bf8d2af --- /dev/null +++ b/src/intermediate/latex_fragment.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ILatexFragment {} + +impl ILatexFragment { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::LatexFragment<'parse>, + ) -> Result { + Ok(ILatexFragment {}) + } +} diff --git a/src/intermediate/line_break.rs b/src/intermediate/line_break.rs new file mode 100644 index 0000000..da94610 --- /dev/null +++ b/src/intermediate/line_break.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ILineBreak {} + +impl ILineBreak { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::LineBreak<'parse>, + ) -> Result { + Ok(ILineBreak {}) + } +} diff --git a/src/intermediate/mod.rs b/src/intermediate/mod.rs index b363853..af8cb43 100644 --- a/src/intermediate/mod.rs +++ b/src/intermediate/mod.rs @@ -1,28 +1,120 @@ +mod angle_link; +mod babel_call; +mod bold; +mod center_block; +mod citation; +mod citation_reference; +mod clock; +mod code; mod comment; +mod comment_block; mod convert; mod definition; +mod diary_sexp; mod document_element; +mod drawer; +mod dynamic_block; mod element; +mod entity; +mod example_block; +mod export_block; +mod export_snippet; +mod fixed_width_area; +mod footnote_definition; +mod footnote_reference; mod heading; +mod horizontal_rule; +mod inline_babel_call; +mod inline_source_block; +mod italic; mod keyword; +mod latex_environment; +mod latex_fragment; +mod line_break; mod object; +mod org_macro; mod page; mod paragraph; +mod plain_link; +mod plain_list; mod plain_text; +mod planning; +mod property_drawer; +mod quote_block; +mod radio_link; +mod radio_target; mod registry; +mod regular_link; mod section; +mod special_block; +mod src_block; +mod statistics_cookie; +mod strike_through; +mod subscript; +mod superscript; +mod table; mod target; +mod timestamp; +mod underline; mod util; +mod verbatim; +mod verse_block; +pub(crate) use angle_link::IAngleLink; +pub(crate) use babel_call::IBabelCall; +pub(crate) use bold::IBold; +pub(crate) use center_block::ICenterBlock; +pub(crate) use citation::ICitation; +pub(crate) use citation_reference::ICitationReference; +pub(crate) use clock::IClock; +pub(crate) use code::ICode; 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 entity::IEntity; +pub(crate) use example_block::IExampleBlock; +pub(crate) use export_block::IExportBlock; +pub(crate) use export_snippet::IExportSnippet; +pub(crate) use fixed_width_area::IFixedWidthArea; +pub(crate) use footnote_definition::IFootnoteDefinition; +pub(crate) use footnote_reference::IFootnoteReference; pub(crate) use heading::IHeading; +pub(crate) use horizontal_rule::IHorizontalRule; +pub(crate) use inline_babel_call::IInlineBabelCall; +pub(crate) use inline_source_block::IInlineSourceBlock; +pub(crate) use italic::IItalic; pub(crate) use keyword::IKeyword; +pub(crate) use latex_environment::ILatexEnvironment; +pub(crate) use latex_fragment::ILatexFragment; +pub(crate) use line_break::ILineBreak; pub(crate) use object::IObject; +pub(crate) use org_macro::IOrgMacro; pub(crate) use page::BlogPostPage; pub(crate) use paragraph::IParagraph; +pub(crate) use plain_link::IPlainLink; +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 radio_link::IRadioLink; +pub(crate) use radio_target::IRadioTarget; +pub(crate) use regular_link::IRegularLink; pub(crate) use section::ISection; +pub(crate) use special_block::ISpecialBlock; +pub(crate) use src_block::ISrcBlock; +pub(crate) use statistics_cookie::IStatisticsCookie; +pub(crate) use strike_through::IStrikeThrough; +pub(crate) use subscript::ISubscript; +pub(crate) use superscript::ISuperscript; +pub(crate) use table::ITable; pub(crate) use target::ITarget; +pub(crate) use timestamp::ITimestamp; +pub(crate) use underline::IUnderline; +pub(crate) use verbatim::IVerbatim; +pub(crate) use verse_block::IVerseBlock; diff --git a/src/intermediate/object.rs b/src/intermediate/object.rs index 3506a00..7eb9f8f 100644 --- a/src/intermediate/object.rs +++ b/src/intermediate/object.rs @@ -1,13 +1,63 @@ use crate::error::CustomError; +use super::angle_link::IAngleLink; +use super::bold::IBold; +use super::citation::ICitation; +use super::citation_reference::ICitationReference; +use super::code::ICode; +use super::entity::IEntity; +use super::export_snippet::IExportSnippet; +use super::footnote_reference::IFootnoteReference; +use super::inline_babel_call::IInlineBabelCall; +use super::inline_source_block::IInlineSourceBlock; +use super::italic::IItalic; +use super::latex_fragment::ILatexFragment; +use super::line_break::ILineBreak; +use super::org_macro::IOrgMacro; +use super::plain_link::IPlainLink; use super::plain_text::IPlainText; +use super::radio_link::IRadioLink; +use super::radio_target::IRadioTarget; use super::registry::Registry; +use super::regular_link::IRegularLink; +use super::statistics_cookie::IStatisticsCookie; +use super::strike_through::IStrikeThrough; +use super::subscript::ISubscript; +use super::superscript::ISuperscript; +use super::timestamp::ITimestamp; +use super::underline::IUnderline; +use super::verbatim::IVerbatim; use super::ITarget; #[derive(Debug)] pub(crate) enum IObject { + Bold(IBold), + Italic(IItalic), + Underline(IUnderline), + StrikeThrough(IStrikeThrough), + Code(ICode), + Verbatim(IVerbatim), PlainText(IPlainText), + RegularLink(IRegularLink), + RadioLink(IRadioLink), + RadioTarget(IRadioTarget), + PlainLink(IPlainLink), + AngleLink(IAngleLink), + OrgMacro(IOrgMacro), + Entity(IEntity), + LatexFragment(ILatexFragment), + ExportSnippet(IExportSnippet), + FootnoteReference(IFootnoteReference), + Citation(ICitation), + CitationReference(ICitationReference), + InlineBabelCall(IInlineBabelCall), + InlineSourceBlock(IInlineSourceBlock), + LineBreak(ILineBreak), Target(ITarget), + StatisticsCookie(IStatisticsCookie), + Subscript(ISubscript), + Superscript(ISuperscript), + Timestamp(ITimestamp), } impl IObject { @@ -16,37 +66,87 @@ impl IObject { obj: &organic::types::Object<'parse>, ) -> Result { match obj { - organic::types::Object::Bold(_) => todo!(), - organic::types::Object::Italic(_) => todo!(), - organic::types::Object::Underline(_) => todo!(), - organic::types::Object::StrikeThrough(_) => todo!(), - organic::types::Object::Code(_) => todo!(), - organic::types::Object::Verbatim(_) => todo!(), + organic::types::Object::Bold(inner) => { + Ok(IObject::Bold(IBold::new(registry, inner).await?)) + } + organic::types::Object::Italic(inner) => { + Ok(IObject::Italic(IItalic::new(registry, inner).await?)) + } + organic::types::Object::Underline(inner) => { + Ok(IObject::Underline(IUnderline::new(registry, inner).await?)) + } + organic::types::Object::StrikeThrough(inner) => Ok(IObject::StrikeThrough( + IStrikeThrough::new(registry, inner).await?, + )), + organic::types::Object::Code(inner) => { + Ok(IObject::Code(ICode::new(registry, inner).await?)) + } + organic::types::Object::Verbatim(inner) => { + Ok(IObject::Verbatim(IVerbatim::new(registry, inner).await?)) + } organic::types::Object::PlainText(inner) => { Ok(IObject::PlainText(IPlainText::new(registry, inner).await?)) } - organic::types::Object::RegularLink(_) => todo!(), - organic::types::Object::RadioLink(_) => todo!(), - organic::types::Object::RadioTarget(_) => todo!(), - organic::types::Object::PlainLink(_) => todo!(), - organic::types::Object::AngleLink(_) => todo!(), - organic::types::Object::OrgMacro(_) => todo!(), - organic::types::Object::Entity(_) => todo!(), - organic::types::Object::LatexFragment(_) => todo!(), - organic::types::Object::ExportSnippet(_) => todo!(), - organic::types::Object::FootnoteReference(_) => todo!(), - organic::types::Object::Citation(_) => todo!(), - organic::types::Object::CitationReference(_) => todo!(), - organic::types::Object::InlineBabelCall(_) => todo!(), - organic::types::Object::InlineSourceBlock(_) => todo!(), - organic::types::Object::LineBreak(_) => todo!(), + organic::types::Object::RegularLink(inner) => Ok(IObject::RegularLink( + IRegularLink::new(registry, inner).await?, + )), + organic::types::Object::RadioLink(inner) => { + Ok(IObject::RadioLink(IRadioLink::new(registry, inner).await?)) + } + organic::types::Object::RadioTarget(inner) => Ok(IObject::RadioTarget( + IRadioTarget::new(registry, inner).await?, + )), + organic::types::Object::PlainLink(inner) => { + Ok(IObject::PlainLink(IPlainLink::new(registry, inner).await?)) + } + organic::types::Object::AngleLink(inner) => { + Ok(IObject::AngleLink(IAngleLink::new(registry, inner).await?)) + } + organic::types::Object::OrgMacro(inner) => { + Ok(IObject::OrgMacro(IOrgMacro::new(registry, inner).await?)) + } + organic::types::Object::Entity(inner) => { + Ok(IObject::Entity(IEntity::new(registry, inner).await?)) + } + organic::types::Object::LatexFragment(inner) => Ok(IObject::LatexFragment( + ILatexFragment::new(registry, inner).await?, + )), + organic::types::Object::ExportSnippet(inner) => Ok(IObject::ExportSnippet( + IExportSnippet::new(registry, inner).await?, + )), + organic::types::Object::FootnoteReference(inner) => Ok(IObject::FootnoteReference( + IFootnoteReference::new(registry, inner).await?, + )), + organic::types::Object::Citation(inner) => { + Ok(IObject::Citation(ICitation::new(registry, inner).await?)) + } + organic::types::Object::CitationReference(inner) => Ok(IObject::CitationReference( + ICitationReference::new(registry, inner).await?, + )), + organic::types::Object::InlineBabelCall(inner) => Ok(IObject::InlineBabelCall( + IInlineBabelCall::new(registry, inner).await?, + )), + organic::types::Object::InlineSourceBlock(inner) => Ok(IObject::InlineSourceBlock( + IInlineSourceBlock::new(registry, inner).await?, + )), + organic::types::Object::LineBreak(inner) => { + Ok(IObject::LineBreak(ILineBreak::new(registry, inner).await?)) + } organic::types::Object::Target(inner) => { Ok(IObject::Target(ITarget::new(registry, inner).await?)) } - organic::types::Object::StatisticsCookie(_) => todo!(), - organic::types::Object::Subscript(_) => todo!(), - organic::types::Object::Superscript(_) => todo!(), - organic::types::Object::Timestamp(_) => todo!(), + organic::types::Object::StatisticsCookie(inner) => Ok(IObject::StatisticsCookie( + IStatisticsCookie::new(registry, inner).await?, + )), + organic::types::Object::Subscript(inner) => { + Ok(IObject::Subscript(ISubscript::new(registry, inner).await?)) + } + organic::types::Object::Superscript(inner) => Ok(IObject::Superscript( + ISuperscript::new(registry, inner).await?, + )), + organic::types::Object::Timestamp(inner) => { + Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?)) + } } } } diff --git a/src/intermediate/org_macro.rs b/src/intermediate/org_macro.rs new file mode 100644 index 0000000..328d89a --- /dev/null +++ b/src/intermediate/org_macro.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IOrgMacro {} + +impl IOrgMacro { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::OrgMacro<'parse>, + ) -> Result { + Ok(IOrgMacro {}) + } +} diff --git a/src/intermediate/plain_link.rs b/src/intermediate/plain_link.rs new file mode 100644 index 0000000..8e702ed --- /dev/null +++ b/src/intermediate/plain_link.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IPlainLink {} + +impl IPlainLink { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::PlainLink<'parse>, + ) -> Result { + Ok(IPlainLink {}) + } +} diff --git a/src/intermediate/plain_list.rs b/src/intermediate/plain_list.rs new file mode 100644 index 0000000..3b1eac8 --- /dev/null +++ b/src/intermediate/plain_list.rs @@ -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 { + Ok(IPlainList {}) + } +} diff --git a/src/intermediate/planning.rs b/src/intermediate/planning.rs new file mode 100644 index 0000000..d34c607 --- /dev/null +++ b/src/intermediate/planning.rs @@ -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 { + Ok(IPlanning {}) + } +} diff --git a/src/intermediate/property_drawer.rs b/src/intermediate/property_drawer.rs new file mode 100644 index 0000000..422ab0d --- /dev/null +++ b/src/intermediate/property_drawer.rs @@ -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 { + Ok(IPropertyDrawer {}) + } +} diff --git a/src/intermediate/quote_block.rs b/src/intermediate/quote_block.rs new file mode 100644 index 0000000..d28f7ed --- /dev/null +++ b/src/intermediate/quote_block.rs @@ -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 { + Ok(IQuoteBlock {}) + } +} diff --git a/src/intermediate/radio_link.rs b/src/intermediate/radio_link.rs new file mode 100644 index 0000000..6886169 --- /dev/null +++ b/src/intermediate/radio_link.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IRadioLink {} + +impl IRadioLink { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::RadioLink<'parse>, + ) -> Result { + Ok(IRadioLink {}) + } +} diff --git a/src/intermediate/radio_target.rs b/src/intermediate/radio_target.rs new file mode 100644 index 0000000..4077c29 --- /dev/null +++ b/src/intermediate/radio_target.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IRadioTarget {} + +impl IRadioTarget { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::RadioTarget<'parse>, + ) -> Result { + Ok(IRadioTarget {}) + } +} diff --git a/src/intermediate/regular_link.rs b/src/intermediate/regular_link.rs new file mode 100644 index 0000000..2f06e4b --- /dev/null +++ b/src/intermediate/regular_link.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IRegularLink {} + +impl IRegularLink { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::RegularLink<'parse>, + ) -> Result { + Ok(IRegularLink {}) + } +} diff --git a/src/intermediate/special_block.rs b/src/intermediate/special_block.rs new file mode 100644 index 0000000..252c347 --- /dev/null +++ b/src/intermediate/special_block.rs @@ -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 { + Ok(ISpecialBlock {}) + } +} diff --git a/src/intermediate/src_block.rs b/src/intermediate/src_block.rs new file mode 100644 index 0000000..ed90cd0 --- /dev/null +++ b/src/intermediate/src_block.rs @@ -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 { + Ok(ISrcBlock {}) + } +} diff --git a/src/intermediate/statistics_cookie.rs b/src/intermediate/statistics_cookie.rs new file mode 100644 index 0000000..e9f8043 --- /dev/null +++ b/src/intermediate/statistics_cookie.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IStatisticsCookie {} + +impl IStatisticsCookie { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::StatisticsCookie<'parse>, + ) -> Result { + Ok(IStatisticsCookie {}) + } +} diff --git a/src/intermediate/strike_through.rs b/src/intermediate/strike_through.rs new file mode 100644 index 0000000..5609432 --- /dev/null +++ b/src/intermediate/strike_through.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IStrikeThrough {} + +impl IStrikeThrough { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::StrikeThrough<'parse>, + ) -> Result { + Ok(IStrikeThrough {}) + } +} diff --git a/src/intermediate/subscript.rs b/src/intermediate/subscript.rs new file mode 100644 index 0000000..60f41c5 --- /dev/null +++ b/src/intermediate/subscript.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ISubscript {} + +impl ISubscript { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Subscript<'parse>, + ) -> Result { + Ok(ISubscript {}) + } +} diff --git a/src/intermediate/superscript.rs b/src/intermediate/superscript.rs new file mode 100644 index 0000000..2293347 --- /dev/null +++ b/src/intermediate/superscript.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ISuperscript {} + +impl ISuperscript { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Superscript<'parse>, + ) -> Result { + Ok(ISuperscript {}) + } +} diff --git a/src/intermediate/table.rs b/src/intermediate/table.rs new file mode 100644 index 0000000..2ce2814 --- /dev/null +++ b/src/intermediate/table.rs @@ -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 { + Ok(ITable {}) + } +} diff --git a/src/intermediate/timestamp.rs b/src/intermediate/timestamp.rs new file mode 100644 index 0000000..db8d307 --- /dev/null +++ b/src/intermediate/timestamp.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct ITimestamp {} + +impl ITimestamp { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Timestamp<'parse>, + ) -> Result { + Ok(ITimestamp {}) + } +} diff --git a/src/intermediate/underline.rs b/src/intermediate/underline.rs new file mode 100644 index 0000000..4d147a4 --- /dev/null +++ b/src/intermediate/underline.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IUnderline {} + +impl IUnderline { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Underline<'parse>, + ) -> Result { + Ok(IUnderline {}) + } +} diff --git a/src/intermediate/verbatim.rs b/src/intermediate/verbatim.rs new file mode 100644 index 0000000..e9a2d01 --- /dev/null +++ b/src/intermediate/verbatim.rs @@ -0,0 +1,15 @@ +use crate::error::CustomError; + +use super::registry::Registry; + +#[derive(Debug)] +pub(crate) struct IVerbatim {} + +impl IVerbatim { + pub(crate) async fn new<'parse>( + registry: &mut Registry<'parse>, + original: &organic::types::Verbatim<'parse>, + ) -> Result { + Ok(IVerbatim {}) + } +} diff --git a/src/intermediate/verse_block.rs b/src/intermediate/verse_block.rs new file mode 100644 index 0000000..3c8626d --- /dev/null +++ b/src/intermediate/verse_block.rs @@ -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 { + Ok(IVerseBlock {}) + } +}