Add the skeletons for the objects.
This commit is contained in:
@@ -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?))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user