Add the skeletons for the objects.

This commit is contained in:
Tom Alexander 2023-10-27 17:48:19 -04:00
parent 23713a934c
commit b0ac14ee58
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
54 changed files with 1326 additions and 25 deletions

23
src/context/angle_link.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IAngleLink,
) -> Result<RenderAngleLink, CustomError> {
Ok(RenderAngleLink {})
}
}

23
src/context/bold.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IBold,
) -> Result<RenderBold, CustomError> {
Ok(RenderBold {})
}
}

23
src/context/citation.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ICitation,
) -> Result<RenderCitation, CustomError> {
Ok(RenderCitation {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ICitationReference,
) -> Result<RenderCitationReference, CustomError> {
Ok(RenderCitationReference {})
}
}

23
src/context/code.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ICode,
) -> Result<RenderCode, CustomError> {
Ok(RenderCode {})
}
}

23
src/context/entity.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IEntity,
) -> Result<RenderEntity, CustomError> {
Ok(RenderEntity {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IExportSnippet,
) -> Result<RenderExportSnippet, CustomError> {
Ok(RenderExportSnippet {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IFootnoteReference,
) -> Result<RenderFootnoteReference, CustomError> {
Ok(RenderFootnoteReference {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IInlineBabelCall,
) -> Result<RenderInlineBabelCall, CustomError> {
Ok(RenderInlineBabelCall {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IInlineSourceBlock,
) -> Result<RenderInlineSourceBlock, CustomError> {
Ok(RenderInlineSourceBlock {})
}
}

23
src/context/italic.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IItalic,
) -> Result<RenderItalic, CustomError> {
Ok(RenderItalic {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ILatexFragment,
) -> Result<RenderLatexFragment, CustomError> {
Ok(RenderLatexFragment {})
}
}

23
src/context/line_break.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ILineBreak,
) -> Result<RenderLineBreak, CustomError> {
Ok(RenderLineBreak {})
}
}

View File

@ -1,7 +1,12 @@
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;
@ -9,27 +14,47 @@ 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;

View File

@ -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<RenderObject, CustomError> {
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,
)?)),
}
}
}

23
src/context/org_macro.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IOrgMacro,
) -> Result<RenderOrgMacro, CustomError> {
Ok(RenderOrgMacro {})
}
}

23
src/context/plain_link.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IPlainLink,
) -> Result<RenderPlainLink, CustomError> {
Ok(RenderPlainLink {})
}
}

23
src/context/radio_link.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IRadioLink,
) -> Result<RenderRadioLink, CustomError> {
Ok(RenderRadioLink {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IRadioTarget,
) -> Result<RenderRadioTarget, CustomError> {
Ok(RenderRadioTarget {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IRegularLink,
) -> Result<RenderRegularLink, CustomError> {
Ok(RenderRegularLink {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IStatisticsCookie,
) -> Result<RenderStatisticsCookie, CustomError> {
Ok(RenderStatisticsCookie {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IStrikeThrough,
) -> Result<RenderStrikeThrough, CustomError> {
Ok(RenderStrikeThrough {})
}
}

23
src/context/subscript.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ISubscript,
) -> Result<RenderSubscript, CustomError> {
Ok(RenderSubscript {})
}
}

View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ISuperscript,
) -> Result<RenderSuperscript, CustomError> {
Ok(RenderSuperscript {})
}
}

23
src/context/timestamp.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &ITimestamp,
) -> Result<RenderTimestamp, CustomError> {
Ok(RenderTimestamp {})
}
}

23
src/context/underline.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IUnderline,
) -> Result<RenderUnderline, CustomError> {
Ok(RenderUnderline {})
}
}

23
src/context/verbatim.rs Normal file
View File

@ -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<D: AsRef<Path>, F: AsRef<Path>>(
config: &Config,
output_directory: D,
output_file: F,
comment: &IVerbatim,
) -> Result<RenderVerbatim, CustomError> {
Ok(RenderVerbatim {})
}
}

View File

@ -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<IAngleLink, CustomError> {
Ok(IAngleLink {})
}
}

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

@ -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<IBold, CustomError> {
Ok(IBold {})
}
}

View File

@ -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<ICitation, CustomError> {
Ok(ICitation {})
}
}

View File

@ -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<ICitationReference, CustomError> {
Ok(ICitationReference {})
}
}

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

@ -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<ICode, CustomError> {
Ok(ICode {})
}
}

View File

@ -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<IEntity, CustomError> {
Ok(IEntity {})
}
}

View File

@ -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<IExportSnippet, CustomError> {
Ok(IExportSnippet {})
}
}

View File

@ -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<IFootnoteReference, CustomError> {
Ok(IFootnoteReference {})
}
}

View File

@ -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<IInlineBabelCall, CustomError> {
Ok(IInlineBabelCall {})
}
}

View File

@ -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<IInlineSourceBlock, CustomError> {
Ok(IInlineSourceBlock {})
}
}

View File

@ -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<IItalic, CustomError> {
Ok(IItalic {})
}
}

View File

@ -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<ILatexFragment, CustomError> {
Ok(ILatexFragment {})
}
}

View File

@ -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<ILineBreak, CustomError> {
Ok(ILineBreak {})
}
}

View File

@ -1,6 +1,11 @@
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;
@ -10,33 +15,58 @@ 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;
@ -46,25 +76,45 @@ 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;

View File

@ -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<IObject, CustomError> {
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?))
}
}
}
}

View File

@ -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<IOrgMacro, CustomError> {
Ok(IOrgMacro {})
}
}

View File

@ -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<IPlainLink, CustomError> {
Ok(IPlainLink {})
}
}

View File

@ -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<IRadioLink, CustomError> {
Ok(IRadioLink {})
}
}

View File

@ -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<IRadioTarget, CustomError> {
Ok(IRadioTarget {})
}
}

View File

@ -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<IRegularLink, CustomError> {
Ok(IRegularLink {})
}
}

View File

@ -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<IStatisticsCookie, CustomError> {
Ok(IStatisticsCookie {})
}
}

View File

@ -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<IStrikeThrough, CustomError> {
Ok(IStrikeThrough {})
}
}

View File

@ -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<ISubscript, CustomError> {
Ok(ISubscript {})
}
}

View File

@ -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<ISuperscript, CustomError> {
Ok(ISuperscript {})
}
}

View File

@ -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<ITimestamp, CustomError> {
Ok(ITimestamp {})
}
}

View File

@ -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<IUnderline, CustomError> {
Ok(IUnderline {})
}
}

View File

@ -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<IVerbatim, CustomError> {
Ok(IVerbatim {})
}
}